Creating a cell and allocation specific text
Ältere Kommentare anzeigen
Hello,
My objective is to create an array cell like:
result = {'Intercept','X1','X2','X3',....'X41'}, in the 1st colum I got the word Intercept, and 2nd X1, 3rd X2, so on until reach X41 in the 42th colum
result = cell(1,42);
result{1,1} = 'Intercept';
result_aux = sprintfc('X%d', 1:41);
result{1,2:end} = result_aux; % Here i get the error
From the last code line i get this error message:
Expected one output from a curly brace or dot indexing expression, but there were 41 results.
What am I doing wrong?
Thanks
Akzeptierte Antwort
Weitere Antworten (2)
KSSV
am 9 Apr. 2019
result = cell(1,length(beta));
result{1,1} = {'Intercept'};
result_aux = sprintfc('X%d', 1:41);
legend{1,2:end} = legend_aux; % Here i get the error
1 Kommentar
madhan ravi
am 9 Apr. 2019
Bearbeitet: madhan ravi
am 9 Apr. 2019
KSSV isn’t this the exact copy from the question?
Tiago Dias
am 9 Apr. 2019
0 Stimmen
2 Kommentare
madhan ravi
am 9 Apr. 2019
Bearbeitet: madhan ravi
am 9 Apr. 2019
That’s exactly how Alex showed in his answer.
Tiago Dias
am 9 Apr. 2019
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!