Long variable in simulink mask gets truncated

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.

 채택된 답변

Andrew Simpson
Andrew Simpson 2014년 5월 27일

0 개 추천

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!)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Subsystems에 대해 자세히 알아보기

제품

질문:

2014년 5월 26일

답변:

2014년 5월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by