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!