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!