how to create a dynamically changing in size column vector?
1 view (last 30 days)
Show older comments
if I wanted to create a column vector and want to fill each vector element with characters that are not the same size for example: signalname = ['Torque';'Torque1'] How to I make signalname change in size to accommodate any element size.
note: error is; Dimensions of matrices being concatenated are not consistent.
0 Comments
Answers (1)
Walter Roberson
on 4 Mar 2016
signalname = {'Torque';'Torque1'};
This will give you a column vector of cells. Each of the cells will contain a row vector of characters (that is, a string.) You would access the content with signalname{i} instead of signalname(i)
Another possibility is
signalname = char({'Torque';'Torque1'});
This will give you a 2 x 7 char array in which you accessed signalname(i,:) to get the content. Each row in which the original content was shorter than the longest line will be blank padded, so you may wish to use strtrim(). Note that this does not satisfy your requirement that a vector be used.
0 Comments
See Also
Categories
Find more on Cell 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!