Hello a newest asking for help.
I have a function to calculate in a loop a variable.
function Ls= WeLatente(WeSolFin,Lc,Ds)
Ls=zeros(1,6);
Ls=0;
k=6;
for k=1:k
Ls(k)=Ls(k)+WeSolFin(k)'*Lc*Ds;
end
and I get 2 errors messages :
Not enough input arguments.
and
Error in WeLatente (line 6)
Ls(k)=Ls(k)+WeSolFin(k)'*Lc*Ds;
Any help i'll appreciate.

댓글 수: 4

When you called it what values did you pass in for WeSolFin, Lc, and Ds?
Also instead of this:
k=6;
for k=1:k
you should just do this
for k=1:6
Hichem Younsi
Hichem Younsi 2018년 12월 22일
Image Analyst yes i have the data WeSolFin, Lc and Ds in a file .mat named the same. WeSolFin is a (1,6) Lc and Ds are constants.
for the second point: i was writing it like this befor for k=1:6
and i get errros i'll change that again and i see
It is not enough that WeSolFin, Lc, and Ds exist in .mat files. You have to load them into memory and you have to pass them in when you call WeLatente
Note that
k=6;
for k=1:k
is confusing. It would be recommended to use a different variable name for the upper bound than is used for the loop index.
Hichem Younsi
Hichem Younsi 2018년 12월 22일
Walter Roberson can you more explecite please to how to use them on memory, i'm runing the code on the script m.file shouldn't he call the variables and data that is on the path file! ?

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

 채택된 답변

madhan ravi
madhan ravi 2018년 12월 22일
편집: madhan ravi 2018년 12월 22일

0 개 추천

EDITED
Addendum to sir Image Analyst and sir Walter's comments:
upload your .mat file
load matlab.mat % load your .mat file
Ls= WeLatente(WeSolFin{:,:},Lc,Ds) % function call
function Ls= WeLatente(WeSolFin,Lc,Ds) % function definition
Ls=zeros(1,6);
k=6;
for i=2:k
Ls(i)=Ls(i-1)+WeSolFin(k)'*Lc*Ds;
end
end

추가 답변 (0개)

카테고리

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

제품

릴리스

R2018b

태그

질문:

2018년 12월 22일

편집:

2018년 12월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by