How to change underlying char data to double with cells
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
How to change underlying char data to double with cells:
The struct I have is:
roofM.materials.volumetricHeatCapacity = is a cell
roofM.materials.volumetricHeatCapacity{1} = is a char (e.g. '3456')
I want to change the char to double for futher processing.
can't seem to get it to work, any help is appreciated!
0 件のコメント
採用された回答
Sahithi Kanumarlapudi
2019 年 10 月 30 日
‘strnum’ can be used to convert data of type ‘char’ to ‘double’
So in your case you can apply this function to each element of the cell using ‘cellfun’
The following line converts your data from char to double
cellfun(@str2num, roofM.materials.volumetricHeatCapacity);
For more information on ‘cellfun’ and ‘strnum’ refer to the following links
Hope this helps!
1 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!