cell array concatenation problem

1 visualización (últimos 30 días)
Leor Greenberger
Leor Greenberger el 13 de Mayo de 2013
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!

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 13 de Mayo de 2013
Editada: Azzi Abdelmalek el 13 de Mayo de 2013
What is the problem? your screen is too small to display the whole string
  1 comentario
Leor Greenberger
Leor Greenberger el 13 de Mayo de 2013
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by