uint32 function example produces the "Index exceeds the number of array elements (1)" error

When running the Convert to 32-Bit Unsigned Integer Variable.mlx example in Matlab it produces the "Index exceeds the number of array elements (1)". It does not produce the Matworks resut. Why?

3 件のコメント

dpb
dpb 2019 年 5 月 9 日
dunno w/o seeing exactly what you did and error message in context...don't even know what example that would be.
dpb
dpb 2019 年 5 月 10 日
編集済み: dpb 2019 年 5 月 10 日
[Gilles Answer moved to comment--dpb]
Just type uint32 in R2019 Documentation Search
and read throug and execute example.
or here
dpb
dpb 2019 年 5 月 10 日
Still dunno w/o seeing further details...works here.
Cut 'n paste commands to command line and I'll be extremely surprised if it doesn't work.
I've never used those pretty features; quite possible there's a typo in there or something I suppose.

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2019 年 5 月 10 日

0 投票

When you execute a Live Script (.slx) then except for parts within a "function", it is a script like non-live scripts, which is to say that it executes within the context of the workspace of the caller ... inheriting whatever assignments have already been done.
So, the difficulty you are encountering is that in your base workspace, you have a variable named class or a variable named uint32 so when you execute the example code, referring to class(x) or uint32(x) would be a subscript request rather than a function call.

その他の回答 (0 件)

カテゴリ

製品

リリース

R2019a

質問済み:

2019 年 5 月 9 日

回答済み:

2019 年 5 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by