regarding storage issues for mixed-type value matrix
Show older comments
There has a loop in my program, and during each iteration an ID will be generated. I want to store these IDs into a two dimensional array, i.e., A. The first column of A stores the iteration number, i.e., A(1,1) = 1 and A(2,1) = 2. The second column of A stores the ID generated during each iteration, i.e., A(1,2) stores the ID generated during the first iteration. The tricky part is that these IDs can be either a numerical value or a string. For instance, A(1,2) = 12345; A(2,2) = abcde. Which kind of data structure should I use to store this mixed-value matrix?
Accepted Answer
More Answers (1)
Image Analyst
on 23 Nov 2011
0 votes
I'd use an array of structures. I think it would be simplest. However you can use a cell array if you want, though figuring out when to use parentheses and when to use braces can be tricky.
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!