cell array concatenation problem
1 view (last 30 days)
Show older comments
Hi
I am not sure what I am doing wrong. I have the following code.
BWL = [200 350 500 1000]*1E6;
filename = cell(4,2);
filename(:,1) = cellstr(strcat({'Sub Bandwidth '}, num2str(BWL'/1E6,'%-d')));
filename(:,2) = strcat(filename(:,1),' D1M ');
filename(:,1) = strcat(filename(:,1),' D50 ');
This gives me the following output.
filename =
'Sub Bandwidth 200 D50' 'Sub Bandwidth 200 D1M'
'Sub Bandwidth 350 D50' 'Sub Bandwidth 350 D1M'
'Sub Bandwidth 500 D50' 'Sub Bandwidth 500 D1M'
'Sub Bandwidth 1000 D50' 'Sub Bandwidth 1000 D1M'
This is what I want. Now when I add the following line of code.
filename = strcat(filename,{' MHz VISA _9500.mc'});
filename =
[1x39 char] [1x39 char]
[1x39 char] [1x39 char]
[1x39 char] [1x39 char]
[1x40 char] [1x40 char]
I don't understand why I end up with a cell array of chars instead of strings? Every line up until this point used strcat and output a cell array of strings. Can anyone help me understand what is happening and whether what I have here is the best way/fewest lines of code to get what I want? Thanks!
0 Comments
Answers (1)
Azzi Abdelmalek
on 13 May 2013
Edited: Azzi Abdelmalek
on 13 May 2013
What is the problem? your screen is too small to display the whole string
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!