how to handle array of string?
Inside a Matlab function I need something like (as you can imagine in real life it should be represented as a fo开发者_如何学Gor loop):
var(1) = 'First string';
var(2) = 'Second string';
...
var(i) = 'i-th string';
Alas, I can't do this cause var(1) should contain just a character (not an entire string) and I get:
??? Subscripted assignment dimension mismatch.
I've searching on the web, but I can't find a good solution, any ideas?
Use a Matlab cell array:
var{1} = 'first string';
var{2} = 'second string';
var{n} = 'nth string';
精彩评论