Need some help with function call

조회 수: 1 (최근 30일)
upinderjeet
upinderjeet 2014년 12월 10일
댓글: Guillaume 2014년 12월 11일
Hello
I am trying to call this function from a code in m-file.
function [] = DiffOCV( k,DYNData,model)
OCVfromSOC(DYNData.soc(k+1),model) ...
- OCVfromSOC(DYNData.soc(k),model) ...
/DYNData.soc(k+1) ...
-DYNData.soc(k)
end
Please note that:
1. 'DYNData' is a structure variable in some .mat file called ECE5550data.mat,
2. 'model' is a structure variable in some .mat file called ECE5550cell.mat and
3. OCVfromSOC(zk,model) is some another function
And all these are actually in the same folder and path as the m-file I am trying to execute. I need to call this function(described above as 'DiffOCV') in my m-file so that it can return me a value that I can use. How can do this. I know I am screwing the way I am passing input arguments or the way I am calling the function. Need to learn both. Please help if you can.
Thanks

답변 (1개)

Guillaume
Guillaume 2014년 12월 10일
Well, for the function to return you a value that you can use, you need to declare that return value in the function signature and assign the result of the computation to it:
function out = DiffOCV(k, DYNData, model)
out = OCVfromSOC(DYNData.soc(k+1),model) ...
- OCVfromSOC(DYNData.soc(k),model) / DYNData.soc(k+1) ...
- DYNData.soc(k);
end
  댓글 수: 2
upinderjeet
upinderjeet 2014년 12월 11일
Thanks
And also please see if you can help with other issues I am having as described in the question I asked.
Guillaume
Guillaume 2014년 12월 11일
What other issues?

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

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by