Long variable in simulink mask gets truncated

7 views (last 30 days)
I've run into an odd problem with a simulink mask.
The mask initialisation code loads a data file and sets many of the mask variables automatically. Some of these are very large matrices (there are several large 2D lookup tables in the mask). There are a few variables which can be hand altered by the user. I have a script, matrix2param, which converts the matrix into a string, which I can then use with set_param to set up the mask every time it runs.
One of the variables is very big. Let's call it lookupDataA. When I run matrix2param on this in the command line, it truncates with:
.... Output truncated. Text exceeds maximum line length of 25,000 characters for Command Window display.
The initialisation code runs fine and the model runs fine, but when I double click on the mask to hand-edit the other parameters, lookupDataA is truncated at the same point. This means I cannot then click "OK" as I get an error pop-up.
This only becomes an issue when the mask parameters window is opened - obviously the data is intact until this point.
In the short term I can use set_param from the command line to set the other parameters.
Is there a way around this truncation? For example I would be happy to hide these parameters so they don't appear when I open the mask parameters.

Accepted Answer

Andrew Simpson
Andrew Simpson on 27 May 2014
To update this for anyone else having the same problem, I opened a support call and have come up with the following workaround with their advice. Instead of setting the parameter to the value of the variable, I now use assignin to put the variable in the base workspace, and then set the parameter to the name of the variable. Something like this:
>> load('saved_params.mat');
>> assignin('base', 'saved_param', saved_param);
>> set_param('untitled/Gain','Gain','saved_param')
This works correctly and sorts the problem (although it could lead to a very messy base workspace - but that's another problem!)

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!