Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
For loop and array type
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Matt J
il 18 Set 2020
Best guess - your loop has reached a z for which allcsvfiles{z,1}(:,4) contains text. Use dbstop() to check.
0 Commenti
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!