Need some help with function call

1 vue (au cours des 30 derniers jours)
upinderjeet
upinderjeet le 10 Déc 2014
Commenté : Guillaume le 11 Déc 2014
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

Réponses (1)

Guillaume
Guillaume le 10 Déc 2014
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 commentaires
upinderjeet
upinderjeet le 11 Déc 2014
Thanks
And also please see if you can help with other issues I am having as described in the question I asked.
Guillaume
Guillaume le 11 Déc 2014
What other issues?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by