Difference between revisions of "Simulink Tester Issues"

From T-VEC Wiki
Jump to: navigation, search
(Embedded Matlab Language (EML) Translation: m-script guidelines)
(Defining a variable and using it outside of the block containing it)
Line 46: Line 46:
 
if (x==4)
 
if (x==4)
 
<br>
 
<br>
s=3;  % variable s is initialized inside the if block
+
&nbsp;&nbsp;s=3;  % variable s is initialized inside the if block
 
<br>
 
<br>
 
end;
 
end;
Line 58: Line 58:
 
<br>
 
<br>
 
s=0;  % variable s is initialized at the function scope
 
s=0;  % variable s is initialized at the function scope
 +
<br>
 
if (x==4)
 
if (x==4)
 
<br>
 
<br>
s=3;  % ok
+
&nbsp;&nbsp;s=3;  % ok
 
<br>
 
<br>
 
end;
 
end;
 
<br>
 
<br>
 
a=x+s; %ok
 
a=x+s; %ok
 +
<br>
 +
<br>
 +
Using the unsupported syntax will cause the following error to be generated:
 +
<br>
 +
ERROR SL0251: (Internal) Unknown variable found while processing embedded Matlab script.
 +
<br>
 +
&nbsp;&nbsp;This is usually caused when a variable is used outside of the scope it was declared within.
 +
<br>
 +
&nbsp;&nbsp;Variable will be grounded. 
 +
<br>
 +
&nbsp;&nbsp;identifier : [identifier]
 +
<br>
 +
&nbsp;&nbsp;scope : [block location]
 +
<br>
 +
&nbsp;&nbsp;line: [line] pos: [column]
 
<br>
 
<br>
  

Revision as of 09:41, 17 June 2008