Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
For loop and array type
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I am having this issue where I am doing a for loop where I am trying to loop 73 times.
In this for loop, I am trying to put column vectors together to create a longer column vector. However, the vectors are not always the same array type. It seemed fine in putting a cell column vector together with a numeric column vector, until on the last loop I got this error:
Conversion to double from cell is not possible.
Here is what my for loop looks like:
for z = 1:73
Round(:,z) = [table2array(allcsvfiles{z,1}(:,4)); zeros(maxsize-size(allcsvfiles{z,1},1),1)];
end
Any ideas why it does not work on the last loop? I've tried making the second vector into cells, but it only makes through one loop. I've also tried making the first vector into numerics, but that also only makes it through the first loop. The only time I've gotten close to getting through all the loops is with the above code, but with only 72 loops.
0 Kommentare
Antworten (1)
Matt J
am 18 Sep. 2020
Best guess - your loop has reached a z for which allcsvfiles{z,1}(:,4) contains text. Use dbstop() to check.
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!