Need some help with function call
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
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
Voir également
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!