Importing an array from workspace into Simulink, but Simulink can't access the last element in that array
Show older comments
I'm trying to build a model in Simulink right now that uses a custom Matlab function to read in an array containing input data and create a step function. The input array is always a 1x8. Only problem is, when my function tries to call the eighth element in the array, the simulation stops and throws this error:
Index expression out of bounds. Attempted to access element 8. The valid range is 1-7.
What is going on here? Why does it seem like the vector is being concatenated in the import stage? How can I fix this?
EDIT: I have tried using a Signal Specification block set to 8 and using Edit Data/Ports to set the input size for that vector to 8 from -1, neither solution worked, however.
1 Comment
Liang Ma
on 3 Feb 2021
I have the same issue.
Did you resolve it?
If not, this is like a bug of simulink. I would like to call for tech support from mathworks.
Answers (0)
Categories
Find more on String 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!