Need help with a syntax

조회 수: 1 (최근 30일)
hasan alhussaini
hasan alhussaini 2017년 9월 4일
답변: Guillaume 2017년 9월 4일
basically i'm converting an idl syntax to MATlab the idl syntax is known as "fix" which "The FIX function converts a given expression to an integer type. Optionally, the conversion type can be specified at runtime, allowing flexible runtime type-conversion to arbitrary types."
i think its "real" but not sure if theres other alternatives
Thanks

답변 (2개)

Image Analyst
Image Analyst 2017년 9월 4일
Try int32():
intVariable = int32(doubleVariable);
  댓글 수: 1
Guillaume
Guillaume 2017년 9월 4일
It's actually not documented in matlab what the rounding behaviour of the intxx functions actually is. If it is the same as C, then it does indeed do the same as fix.

댓글을 달려면 로그인하십시오.


Guillaume
Guillaume 2017년 9월 4일
The fix function is also available in matlab, if that's what you're asking.
Type information is usually not important in matlab. It's got better in recent releases but there's still plenty of functions that don't work with integer types.

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by