I have different size of data. For example Dat1=12x1, Dat2=15x1, Dat3=19x1
My question is, how can I put the entire data in structure array. This is because easy for me to access the data.
Anyone can help me? Thank you.
You can go structure array Matlab to know how to implement it.
Basically what you need to do is
s = struct('Dat1',Dat1,'Dat2',Dat2, ...)
Just look in the section structure with multiple fields.
Related
I'm new to Matlab and I need some suggestions on how to deal with having many inputs to a function.
The program reads data from multiple elements and stores them in an array, which I'm doing in a loop. The problem is that if I input the wrong information about one element, I must re-input the data all over again. I believe that there must exist a better way to input these data, like reading it from a external file, for example.
The problem with the external file would be, as far as I know, with the reading of multiple arrays from a single file, hence the need of multiple external files - and I believe also that must exist some better way.
As noted by #beaker, you can use save and load to store the data. You can store multiple variables in a given file without a problem.
Using the parse how to retrieve the data to the table view controller if multiple objects are present.
I tried using the query where receptionist equal to current user.
And I tried find objects in background and append it to an array.
But the problem is all the object values appending to the same array.
Read through the Parse IOS Developer's Guide. It has the information & explanations you need to do this.
http://parseplatform.org/docs/ios/guide/
Also, what you're asking really isn't too clear. Try to specify what specific issues you are having along with posting your actual code next time.
I am appending an array of numbers to an existing excel file using this:
dlmwrite(mydatafile,newdataarray,'-append');
I need to add a column to the beginning of the new row for a text identifier (employee name), but I can't get Matlab to write the name to a single cell. Does anyone have any ideas how I'd be able to do this?
Your question is not completely clear, for example it is not completely defined how you can add a column to a row.
If the following does not work I would recommend you to provide a small scale example of the data that you have and the things you want to append.
Assuming you just need to get this done and are not looking for a pretty solution you could try to:
First read it into matlab
Then perform the operation that you like
Then write it to a new file
This will allow you to do pretty much anything but whether it is convenient depends on your specific needs.
I am trying to figure out whats the best data structure to hold the data source for a UITableView. I am looking for something as robust as possible - a structure that will hold data for the different sections, and which will enable convenient add and remove of objects. I saw a few implementations using NSMutableArrays and dictionaries, but I am still not convinced as to which approach is the most robust.
Appreciate your help and thoughts.
NSMutableArray is the most efficient since the index path for row and section readily convert to integers which can be used to access the array elements.
Depends on really how complex your data is. If its just couple of strings then an Array of NSStrings will suffice. If its like an image path, a text label and its description then maybe an array of custom class holding that data. I almost always go for the Arrays since you can get your desired object from it with the objectAtIndex:indexPath.row bit.
I would appreciate some help with something I working on and have not done before now and having some proplems because I don't think I understand exactly how to do this. What I'm wanting to do i'm sure is simple to most all of you and will be to me as soon as I do it the first time correctly....anyway.... I have a tableview that I'm needing to populate with two things, a username and a number with a count of items (the username could be a primary key). Currently I have a tableview populating and editable with an array....no problem....I know how to do that.
The two parts I need help with understanding is to:
read a plist with these two values into a dictionary, and read them into two different arrays that I can use with my tables.
Save the arrays back to the dictionary and then back to a plist.
I think I'm getting the most confused with how to store these two things in dictonary keys and values. I've looked that over but just not "getting it".
I would appreciate some short code examples of how to do this or a better way to accomplish the same thing.
As always, thanks for your awesome help....
You can use NSArray method writeToFile: atomically: to dump your data into a file, you can then use initWithContentOfFile to retrieve the information from t hat file just as you dumped it previosly. I believe if you have dictionaries in your array you should be able to get them back this way. You can always use core data as well for storage if you find your structures to store are getting complex and dumping the in a file and getting them back to recreate some o bjects is becoming messy.
The approach that would perhaps be the simplest is to store the data as an array of dictionaries. This has the issue that recreating the array from a plist with mutable leaves is convoluted at best.
But if you can tolerate the performance hit of replacing dictionaries when updating the list instead of modifying them, it might definitely be the simplest course of action.
This also has the added benefit that your datasource only needs to deal with one array, and that the whole shebang would be Key-Value Compliant, which might further simplify your code.