Error: ()-indexing must appear last in an index expression.

1 次查看(过去 30 天)
clc
clear all
g=xlsread('try22.xlsx');
Dq=g(:,8);
Dz=g(:,9);
Du=g(:,10);
Dv=g(:,11);
Qa=g(:,12);
t=9.81;
R2=[ ];
for i=1:length(g)
R1(i)=(t*(Dq(i)/Dz(i)))/(Qa(i)((Du(i)/Dz(i))^2+(Dv(i)/Dz(i))^2))
R2=[R2;R1(i)];
end
  1 个评论
Walter Roberson
Walter Roberson 2019-7-24
The fragment
(Qa(i)((Du(i)/Dz(i))^2
Has no operation between Qa(i) and what follows.
Madhan assumes that multiplication was intended, which is plausible.

请先登录,再进行评论。

采纳的回答

madhan ravi
madhan ravi 2019-7-24
No loop is needed:
R1=(t*(Dq./Dz)) ./ (Qa.*((Du./Dz).^2+(Dv./Dz).^2));
R2 = R1(:)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by