Hello All,
I created a coding rules option object and saved it into a .mat file. Whenever i have to perform polyspace verification i just load .mat file ans assign it to option object using following command.
prj.Configuration.CodingRulesCodeMetrics.MisraC3Subset = misraRules;
here 'prj' is polyspace project object and 'misraRules' is coding rules option object.
I am getting following object while loading .mat file.
SWITCH expression must be a scalar or a character vector.
Error in polyspace.option.Item/checkValue
Error in polyspace.option.Item/set.Value
Please guide.

댓글 수: 2

Rik
Rik 2021년 2월 16일
I have never worked with Polyspace, but I don't see where you are actually loading data from a mat file into a variable. Where are you doing that?
Darshan Gade
Darshan Gade 2021년 2월 17일
sorry for incomplete data. i have commented below.
thanks

댓글을 달려면 로그인하십시오.

답변 (1개)

Anirban
Anirban 2021년 2월 16일

0 개 추천

You have to share the commands you are using for us to see what might be happening.
If you are simply doing something like this, this seems to work.
>> misraRules = polyspace.CodingRulesOptions('misraC2012'); % Creating rules object
>> misraRules.Section_2_Unused_code.rule_2_1 = false; % Some rule disabling
>> save('file.mat','misraRules') % Saving to mat file
>> clear % Starting from a clean workspace
>> load('file.mat','misraRules') % Loading rules object from mat file
>> proj = polyspace.Project; % Creating project object
>> proj.Configuration.CodingRulesCodeMetrics.MisraC3Subset = misraRules; % Assigning rules to project

댓글 수: 3

Thats exactly what i did to create file.mat (first 3 lines). Once file.mat is available in current directory, for first run of polyspace verification i am not getting any Errors, but if i clear everything and again tried to do load file.mat file, i am getting error mentioned in qiestion.
my code:
load('MisraRules.mat');
prj = polyspace.Project;
prj.Configuration = polyspace.ModelLinkOptions([ModelName, '_ac']);
prj.Configuration.CodingRulesCodeMetrics.MisraC3Subset = misraRules;
prj.Configuration.CodingRulesCodeMetrics.EnableMisraC3 = true;
note in my case file.mat is MisraRules.mat and [ModelName_'ac'] is my simulink model name.
Anirban
Anirban 2021년 2월 18일
One question: are you generating and loading the mat file using the same release of MATLAB/Polyspace ? Or is it possible that the mat file was generated using a different version? Actually, if you can give the version numbers of your MATLAB and Polyspace, it will help.
Darshan Gade
Darshan Gade 2021년 2월 18일
I think that could be the issue as .mat file is created with MATLAB\polyspace 2020b and i am using it on MATLAB\Polyspace 2018b

댓글을 달려면 로그인하십시오.

질문:

2021년 2월 16일

댓글:

2021년 2월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by