Index exceeds matrix dimensions sim command, not in Simulink

I tried finding a solution to my problem, but all the hits on both google and on-site search came with topics that were not similar to mine. Apologies if I didn't look far enough.
My issue: I have a Simulink model and a .m file in which I write parameters and run the simulation using the sim() command. Since a short while, I cannot remember what changes I made that started this, Matlab returns the 'Index exceeds matrix dimensions' error whenever I run the sim() command or when I Rightclick on the .slx file and hit Run in the folder-viewer in matlab (or F9 hotkey). However, if I run the config with the sim() command commented out and manually hit the green Simulate button inside the simulink model, it does run perfectly fine.
Has anybody heard about this before? Does anyone know what could be causing this?
The config file itself is just a series of parameter settings, ending with:
sim('ICSMS_Project_Model')
The simulink file is called ICSMS_Project_Model.slx.
Note that it has worked before, and now doesn't work anymore and I lost track where it stopped working.

4 Comments

I am running in the same situation. Did you have it figured out yet?
I'm sorry, I haven't. I just dealt with it, for the remainder of the project, which only lasted for about two more weeks after this post.
Thanks for the reply. I realized that when you run into this situation, even if you create a new and simple Simulink model e.g. a constant wired to a scope and try sim command with it, you still have this issue.
Do you perhaps have a variable/struct named "sim"? I had one, and renaming it solved this behavior for me.

Sign in to comment.

Answers (0)

Products

Release

R2017a

Asked:

on 10 Sep 2018

Commented:

on 29 Jul 2020

Community Treasure Hunt

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

Start Hunting!