[ERROR] Index exceeds array dimensions. Index value 0 exceeds valid range [1-1] of array Coeff.p01.
11 views (last 30 days)
Show older comments
Hi, I am a new user of Simulink.
I am runnig a simulation in wich I inserted a Matlab function.
I recive the error:
Index exceeds array dimensions. Index value 0 exceeds valid range [1-1] of array Coeff.p01.
That function work like this:
It load a workspace with the values of the variable It need, just number, not matrix or array, and compute the output.
I don't understand why it says that the index value is 0.
Here the code:
function eta_motor = eta_motor(omega_wheel,torque)
Coeff=load('Coeff');
eta_motor=(Coeff.p00+Coeff.p10*(omega_wheel*Coeff.a/Coeff.omega_max)+Coeff.p01(torque*Coeff.b/Coeff.T_max)+...
Coeff.p20(omega_wheel*Coeff.a/Coeff.omega_max)^2+Coeff.p11(omega_wheel*Coeff.a/Coeff.omega_max)*(torque*Coeff.b/Coeff.T_max)+...
Coeff.p02(torque*Coeff.b/Coeff.T_max)^2)/100;
Can you explain me how to correct it?
1 Comment
zhaojifeng zhao
on 28 Nov 2022
Did you solve this problem? how did you solve it, I also had this problem
Answers (1)
per isakson
on 10 Nov 2019
Edited: per isakson
on 10 Nov 2019
I guess that this term causes the error
Coeff.p01(torque*Coeff.b/Coeff.T_max)
and that's because torque*Coeff.b/Coeff.T_max evaluates to zero
And by the way always report the full error message.
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!