Obtain initial data type from cell array if I stored functions in the cell array
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Zicheng Cai
am 5 Jun. 2018
Kommentiert: Zicheng Cai
am 5 Jun. 2018
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191038/image.jpeg)
I want to calculate specific heat of 5 components at a given temperature. If I store the five functions in a cell array. If I try to call e.g. Cp(1), it returns a 1*1 cell containing my function, but not the function itself that I want to use. Can someone help me with this issue. In this function I want to return a vector containing specific heat values. Thank you!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 5 Jun. 2018
You stored using {} indexing and you need to retrieve using {} indexing. Cp{1}
Weitere Antworten (1)
Matt Dickson
am 5 Jun. 2018
To get the value out of the cell by index, use curly brackets to index. For example:
foo = {'bar' 'baz'};
a = foo(1) % a = 1x1 cell
b = foo{1} % b = 'bar'
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!