How to insert different size matrices into each row of a zero matrix
4 次查看(过去 30 天)
显示 更早的评论
I am using a for loop to solve multiple itterations of an equation. for each output, i wan it to store in a new row of a zero matrix, while keeping the output from the previous itteration as shown below
M = [ x1 0 0 0 ;
x1 x2 0 0 ;
x1 x2 x3 0;
x1 x2 x3 x4]
0 个评论
回答(3 个)
Walter Roberson
2023-4-10
newvalues = as appropriate
M(end+1, 1:length(newvalues)) = newvalues;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!