How to proceed in this case?

1 次查看(过去 30 天)
hrushikesh kyathari
评论: dpb 2019-7-13
I have a set of matrices F1,F2,....,F16; each of them is 3*1 matrices.
All these matrices should be stored as
F := [F1,....,F8, 0, ...... ,0;
0,....,F8,F9, ...... ,F16;
0,..,F5,... F12,0,...,0]
and F will be used as k=Z\F;
But I get the error:Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 5-by-1.
I guess we need take use a cell in this case but how to define and also if I use a cell, the calculation Z\F must be done.
The dimensions of Z are good for calculations
  1 个评论
dpb
dpb 2019-7-13
"I have a set of matrices F1,F2,....,F16; ..."
Which is the problem -- do not create multiple variables with sequential names, create these as cell array in the beginning.
Then you can deal with them programmatically via cell2mat() or address each as needed.
Probably given the need to build the 2D array a 2D array would be better than just 1...N
You'll have to build the zeros() arrays as well or use sparse() array addressing modes.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by