Error when simulating in Simulink

5 ビュー (過去 30 日間)
HEBERT
HEBERT 2024 年 5 月 19 日
回答済み: Shivani 2024 年 6 月 20 日
Error:Error in 'untitled/Asynchronous Machine SI Units': Failed to evaluate mask initialization commands.
Caused by:
Index exceeds the number of array elements. Index must not exceed 1.
How can i overcome this?
  1 件のコメント
Ayush Singh
Ayush Singh 2024 年 5 月 22 日
Hi Herbert,
Please share the model as it might be related directly to the model.

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

回答 (1 件)

Shivani
Shivani 2024 年 6 月 20 日
Hello @HEBERT,
The error message you're encountering, typically occurs in Simulink when working with masked blocks or during the initialization of a model or block that involves custom MATLAB code or scripts. This error is indicative of an attempt to access an element of an array or matrix using an index that is larger than the array dimensions, a common issue in programming known as an "index out of bounds" error.
Without access to the source code causing this issue, I will not be able to pinpoint the exact line causing the error. However, you can follow the steps below to potentially resolve this issue:
  • Check the mask initialization commands or MATLAB code linked to the block mentioned in the error message.
  • Within these commands or any custom MATLAB code associated with the model, identify any instances where arrays (including vectors and matrices) are accessed.
  • Note that, as mentioned in the error message, the size of the array you are trying to access is 1. Ensure you initialize the array to the required size before accessing its elements.
  • Make sure that any indexing operations do not exceed the array's dimensions. Remember, MATLAB indices start at 1, not 0.

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by