Index exceeds matrix dimensions

Hello,
I keep getting this error for one of matrices that is in an if loop. I checked the size of the matrix and it is the same size as the for loop limits that the if loop is called in, so I can't figure out how it's trying to access an index that's greater than the size of the matrix.
In the code below the error is happening at the line that calls Rs_Rc(ii,kk) in the if loop, but I've doubled checked and the size of that matrix is the same as the for loop limits. Even the size of the Rc and Rs matrices used to compute Rs_Rc are the same. Please help!
for ii = 1:Z-1
for kk = 1:(N_ofRibs-1)*5
Rc(ii,kk) = sigma_panelbending(ii,kk)/compression_crit(ii,kk);
Rs(ii,kk) = tau_panelshear(ii,kk)/tau_crit(ii,kk);
Rs_Rc(ii,kk) = Rs(ii,kk)^1.5 + Rc(ii,kk);
if Rc(ii,kk) <= 1 && Rs(ii,kk) <= 1 && ...
Rs_frontspar(1,kk) <= 1 && Rb_frontspar(1,kk) <=1
if Rs_Rc(ii,kk) <= 1 && Rb_Rs_frontspar(1,kk)...
&& Rb_Rs_rearspar(1,kk)
if stringer_failure <= 1
Thanks!

Risposte (1)

Set
dbstop if error
run and inspect the variables carefully

Questa domanda è chiusa.

Richiesto:

har
il 7 Giu 2012

Chiuso:

il 20 Ago 2021

Community Treasure Hunt

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

Start Hunting!

Translated by