我正在尝试使用 MatLAB 从 m*n 数据表中选择一个特定的数组。
错误消息:索引超出矩阵维度
检查以下 MatLAB 脚本:
t_res = 0.2;
c_angle = 360/30;
iact = 0.1;
V = 12;
p = 1;
for p=1:length(p),
for p=1:5,
Time = p*t_res;
Angle = Time*c_angle/2;
if (p == 1)
delt_i = 0;
else
delt_i = 0.5* t_res* V /L_obt;
end
iact = iact+delt_i;
[~, ~, raw] = xlsread('F:\User\Matlab\data1.xlsx','Sheet3','A2:D11');
data = reshape([raw{:}],size(raw));
Current = data(:,1);
Angle1 = data(:,2);
Torque = data(:,3);
Fluxlinkage = data(:,4);
F = scatteredInterpolant(Current,Angle1,Fluxlinkage);
Fluxlinkage = F(iact,Angle);
L_obt = Fluxlinkage/iact;
F = scatteredInterpolant(Current,Angle1,Torque);
Torque = F(iact,Angle);
Table = [p' Time' Angle' iact' delt_i' abs(Torque)' Fluxlinkage' L_obt'];
fprintf('%d\t\t %f\t\t %f\t\t %f\t\t %f\t\t %f\t\t %f\t\t %f\n', Table');
end
p=p+1;
Table(3,5);
end
收到错误消息:尝试访问 Table(3,5);索引超出范围,因为 size(Table)=[1,8]