Build arrays under the for loop
3 次查看(过去 30 天)
显示 更早的评论
Hi;
for i=1:10
R"i"= nonzeros(D(i,:));
end
I want to create arrays under the for loop. The arrays wont have the same size. For each increment, the name of the array should be R + the increment number (R1, R2, R3 ....).
The desired result is 10 vectors R1 to R10.
Any hints to do it ?
Thank you in advance
1 个评论
Stephen23
2023-2-13
Use indexing. Indexing is a MATLAB superpower. If you do not use indexing, then using MATLAB will be very ... difficult.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!