错误" ???在赋值A(I)= B中,B和I中的元素数必须相同

时间:2016-04-06 18:08:45

标签: matlab

我正在尝试执行此代码

clc;clear;
disp('nombre_de_travée');
NT=input('NT=');  %nombre_de_travé
thetad=0;
thetag=0;
for i=1:NT
    disp('longueur_de_travée');
    l(i)=input(['l(' num2str(i) '):']);
    disp('nombre_de_charge');
    nch=input(['nch(' num2str(i) '):']); %nombre_de_charge
    for j=1:nch
        disp('type_de_charge');
        nc(i,j)=input(['nc(' num2str(i) ',' num2str(j) ')1_2:']); %type_de_charge
        if nc(i,j)==1
            disp('charge concentrée')

            a(i,j)=input(['a(' num2str(i) ',' num2str(j) '):']);
            p(i,j)=input(['p(' num2str(i) ',' num2str(j) '):']);

            thetad(i)=-p(i,j).*a(i,j).*l(i)./6+thetad;
            thetag(i)=p(i,j).*a(i,j).*l(i)./3+thetag;
        elseif nc(i,j)==2
            disp('moment concentrée')
            m(i,j)=input(['m(' num2str(i) ',' num2str(j) '):']);

            thetad(i)=-m(i,j).*l(i)./6+thetad;
            thetag(i)=m(i,j).*l(i)./3+thetag;
        end
    end
end

但会显示错误消息:

???  In an assignment  A(I) = B, the number of elements
in B and
 I must be the same.

0 个答案:

没有答案