Index exceeds matrix dimensions sim command, not in Simulink
Show older comments
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
Dave Lee
on 1 Aug 2019
I am running in the same situation. Did you have it figured out yet?
Nathan Reiling
on 1 Aug 2019
Dave Lee
on 1 Aug 2019
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.
Nico Rossouw
on 29 Jul 2020
Do you perhaps have a variable/struct named "sim"? I had one, and renaming it solved this behavior for me.
Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!