Azzera filtri
Azzera filtri

strvcat doen not work.

1 visualizzazione (ultimi 30 giorni)
Marcus Vinicius Pereira de Souza
Modificato: Stephen23 il 13 Giu 2017
Dear all, I need to generate some box plots. However, there are several long texts and I need to break in vertical lines. I am using the command strvcat and am not having success. The following is an example of my script:
X = rand(20,6);
boxplot(X);
str={strvcat('cos(x)','Line 2'), strvcat('cos(x)','Line 2'), strvcat('cos(x)','Line 2'),...
strvcat('cos(x)','Line 2'), strvcat('cos(x)','Line 2'),strvcat('cos(x)','Line 2')};
set(gca, 'XTick',1:6,'XTickLabel',str, 'FontSize',8,'FontWeight','bold')
Can I help me? Thanks a lot!
  1 Commento
Stephen23
Stephen23 il 13 Giu 2017
Modificato: Stephen23 il 13 Giu 2017
What makes you think that strvcat does not work? It works perfectly when I try your code:
>> str{1}
ans =
cos(x)
Line 2
>> size(str{1})
ans =
2 6
Of course you should not be using strvcat anyway, as the documentation clearly states: "*Note:* strvcat is not recommended. Use char instead."
The real topic is that you apparently want multiple lines in the XTickLabels, something that is MATLAB version dependent. So if you actually read the help for your installed MATLAB version then you wold learn if newlines are supported in your MATLAB, and how. If you want us to help you, then please tell us in a comment: what version of MATLAB are you using?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by