Need some help with function call

1 visualización (últimos 30 días)
upinderjeet
upinderjeet el 10 de Dic. de 2014
Comentada: Guillaume el 11 de Dic. de 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

Respuestas (1)

Guillaume
Guillaume el 10 de Dic. de 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 comentarios
upinderjeet
upinderjeet el 11 de Dic. de 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 el 11 de Dic. de 2014
What other issues?

Iniciar sesión para comentar.

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by