필터 지우기
필터 지우기

int64 in simulink / stateflow?

조회 수: 8 (최근 30일)
Milan
Milan 2013년 9월 4일
답변: Andy Bartlett 2020년 9월 10일
Hi,
I'm working on a simulink model using stateflow charts, there is no option to declare variables to be of the int64 datatype. When I attempt to use int64(var), it gives me an error saying "Cast to 'int64' class is not supported".
Is there a workaround to this that will allow me to use int64 variables in my model?

답변 (2개)

ES
ES 2013년 9월 4일
Matlab supports int64 whereas Simulink/Stateflow does not.
Workaround will be to use two int32 variables.
so your expected value will be UpperInt32Variable * LowerInt32Variable.
You can increment UpperInt32Variable every time the LowerInt32Variable overflows.
  댓글 수: 1
Milan
Milan 2013년 9월 4일
편집: Milan 2013년 9월 4일
I am multiplying 2 32 bit numbers...what is the correct procedure to multiply 2 32 bit numbers without using a 64 bit variable? I would just get an overflow if the result of the multiplication was higher than 2^31 right?
What is the correct procedure/algorithm to multiply 2 32 bit numbers and store the high 32 bits in one 32 bit variable and low 32 bits in a second 32 bit variable

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


Andy Bartlett
Andy Bartlett 2020년 9월 10일
Update: 64 bit integer modeling in Stateflow is now available.
Stateflow C support of int64 and uint64 is available as of R2019b.
Stateflow M support of int64 and uint64 is available as of R2020a.
As a side note,
when discussing usage of 64 bit integers in Simulink,
the question of required licenses often comes up.
In R2016b and earlier,
use of 64 bit integers in Simulink requires a Fixed-Point Designer license.
As of R2017a,
usage of 64 bit integers in Simulink does not require any additional licenses.

카테고리

Help CenterFile Exchange에서 Complex Logic에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by