define the cell array size for excel data

i have given different inputs to known variables using excel data to solve the equations, but defining the cell array size i am getting the error.
nX = size(X,1 );
Solutions= cell(1, nX);
for S=1:nX
Xo=(Xs+(R(S)*Xr))/(1+R(S));
X =((bt*Qo(S)*(1+R(S))*Xo)+(Y*1000*a*V*J*bs))/(bt*((Qo(S)*(1+R(S)))-((V*Y*k*N)/((Kn*1000)+N))+V*kd));
eqn1=Qo(S)*(1+R(S))*(No(S)-N)-V*((a*J*1000)+((X*k*N)/((Kn*1000)+N)))==0;
eqn2=(sqrt((Lstar^1.76)+(5.2*(Nstar-Nstar_min)))-(Lstar^0.88))/2.6==jstar^0.88;
Solutions=vpasolve([eqn1,eqn2],[N,J]);
temp = struct2cell(Solutions);
sold= vpa(horzcat(temp{:}));

댓글 수: 5

KSSV
KSSV 2021년 2월 8일
Which line throws error and what error? You have to specify.
sunitha
sunitha 2021년 2월 8일
The error is unrecognised variable X and it is showing the error in the line nX=size(X,1)
KSSV
KSSV 2021년 2월 8일
Error is clear right? You hve to define the variable X. Error says clearly you have not defined X.
KSSV
KSSV 2021년 2월 8일
sunitha commented: i have defined the variable X . The error is showing in the while defining the cell array size.Actually i have defined the variable X in the equation
X should be defined before the line:
nX = size(X,1 );

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2021년 2월 8일

0 개 추천

nX = length(R);
Solutions = cell(1, nX);
sold = zeros(nX,2);
for S=1:nX
Xo=(Xs+(R(S)*Xr))/(1+R(S));
X =((bt*Qo(S)*(1+R(S))*Xo)+(Y*1000*a*V*J*bs))/(bt*((Qo(S)*(1+R(S)))-((V*Y*k*N)/((Kn*1000)+N))+V*kd));
eqn1=Qo(S)*(1+R(S))*(No(S)-N)-V*((a*J*1000)+((X*k*N)/((Kn*1000)+N)))==0;
eqn2=(sqrt((Lstar^1.76)+(5.2*(Nstar-Nstar_min)))-(Lstar^0.88))/2.6==jstar^0.88;
Solutions{S} = vpasolve([eqn1,eqn2],[N,J]);
temp = struct2cell(Solutions{S});
sold(S,:) = double(horzcat(temp{:}));
end

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

질문:

2021년 2월 8일

댓글:

2021년 2월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by