Assignment has more non-singleton rhs dimensions than non-singleton subscripts ?
Ältere Kommentare anzeigen
Matrix Q with 29 rows and 1 column
Matrix Ssd with 29 rows and 1 column
All value of components in matrix are given.
z=6;
Code
for k=k+1:36
for Lsd=Lsd+1:144
for t=2:length(Q)
if (Lsd*z)-Ssd(t-1,1)<Q(t,1)
Ssdq(t,1)=(Lsd*z)-Ssd(t-1,1);
-----------------------------------------------------------
When I run this code, I get problem as below
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in thiet (line 239)
Ssdq(t,1)=(Lsd*z)-Ssd(t-1,1);
------------------
But I tried to change Lsd*z with a specific number as Ssdq(t,1)=7-Ssd(t-1,1), this erros disappeared. However, because I need k and Lsd to run continuously with their Limitation to solve my problem. So I can't assign as Ssdq(t,1)=Lsd(t,1)*Z-Ssd(t-1,1), this causes erros exceed matrix dimension.
Please help my solve this problem! Thanks alot!
2 Kommentare
KSSV
am 22 Dez. 2020
This error occurs when you try to save more number of elements then it is initialized for. You need to check the dimensions of created RHS array so that LHS array should be intialized to the same.
Example:
A = zeros(5,1) ;
A(1) = rand(1,3) ; % this will create error
Kevin
am 22 Dez. 2020
Antworten (0)
Kategorien
Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!