double - type matrix with integer and char values
2 views (last 30 days)
Show older comments
Hi, I would know if it's possible create a matrix with two columns where in the first one we have integer values while in the second one i would save character values. Thanks for the answers.
0 Comments
Accepted Answer
Star Strider
on 2 Jun 2014
Edited: Star Strider
on 2 Jun 2014
You can easily do that with a cell array, but not a matrix. Matrices have to have only one data type.
For instance:
for k1 = 1:10
C{k1,1} = k1;
C{k1,2} = char(61+k1);
end
The character array can be anything you want (single letters or symbols here only for demonstration purposes).
More Answers (0)
See Also
Categories
Find more on Logical 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!