Using convpres in MATLAB (single to float conversion)
3 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to use this function https://www.mathworks.com/help/aerotbx/ug/convpres.html
X is a 450x1 single type data.
>> temp1 = typecast(X,'float');
Error using typecast
Unsupported data type for conversion.
>> temp1 = double(X);
>> temp1 = convpres(temp1,'Pa','psi');
Undefined function 'convpres' for input arguments of type 'double'.
I looked up all the usual MATLAB casting technique but to no luck. Can someone comment? Thank you.
0 件のコメント
回答 (1 件)
Sahithi Kanumarlapudi
2020 年 12 月 14 日
Hi,
Your question has two parts
1.) Regarding the use of typecast : You can convert 'single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64' to 'single', 'double', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', or 'uint64' (As you can see there is no float in this list). For more info refer to the documentation of typecast here.
2.) Regarding the use of convpres function: In the code snippet that you have provided, temp1 is of type double. But as per the documentation of convpres, the type of first argument 'valuesToConvert' is expected to be float (Floating-point array of size m-by-n values).
Referring to the documentation of convpres might give you more info: https://in.mathworks.com/help/aerotbx/ug/convpres.html
Hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Low-Level File I/O についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!