how to do a for cycle for cell arrays
Mostra commenti meno recenti
Hello,
i have a cell array that is has 20 cells of 1000*20 tables
I am trying to write the following code:
FA1=data2{1,1}
FA2=data2{1,2}
FA3=data2{1,3}
FA4=data2{1,4}
FA5=data2{1,5}
FA6=data2{1,6}
FA7=data2{1,7}
FA8=data2{1,8}
FA9=data2{1,9}
FA10=data2{1,10}
When I try to transform it into
for i=1:1:10
FA(i)=data2{1,i}
end
I got an error. I would like to know what the way of doing this properly is.
I thank you in advance,
Best regards,
1 Commento
Stephen23
il 25 Feb 2022
"I would like to know what the way of doing this properly is."
The proper way is to use simple and efficient indexing to access the data directly from data2.
Anything else is a waste of time (yours and runtime).
Risposta accettata
Più risposte (1)
Image Analyst
il 25 Feb 2022
The best way to extract the first row of a cell array:
FA = data2(1, :)
FA is another cell array.
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!