How can I put data into cell array at once time?

1 Ansicht (letzte 30 Tage)
Haksun Lee
Haksun Lee am 14 Jun. 2012
Hello~
I am beginner in Matlab.
I know cell function create m-by-n cell array.
For example, temp=cell(1,10) command create cell array of 1-by-10.
I have a question here.
I'd like to put data of 10 into cell array simultaneously.(ex. not to temp(1)=1, temp(2)=3,..temp(10)=2)
Which command can I use if I set the data at cell array at the same time.
I need your help, please.

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 14 Jun. 2012
temp = cell(1,10);
temp([1,2,10]) = {1,3,2}
other way
temp = num2cell([1:9,2]);
etc.
  1 Kommentar
Haksun Lee
Haksun Lee am 15 Jun. 2012
I resolved my problem thanks to your help.
Have a nice day!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by