cell array concatenation problem

1 次查看(过去 30 天)
Leor Greenberger
Leor Greenberger 2013-5-13
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!

回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-5-13
编辑:Azzi Abdelmalek 2013-5-13
What is the problem? your screen is too small to display the whole string
  1 个评论
Leor Greenberger
Leor Greenberger 2013-5-13
Yes, I just realized that there is no problem. I thought that I had a cell array of char arrays when I want a cell array of strings.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by