Real-Time Workshop use Embedded Matlab Function to generate random numbers
Show older comments
Hi everyone, In the Real Time Workshop I am trying to use in an embedded Matlab function in Stateflow the two function “rand” and “round”, but I always get the following error: Failed to eliminate a use of the MATLAB function 'rand/round'. For non-simulation builds, uses of unsupported MATLAB functions are eliminated if they do not effect the model outputs. The code that I am using is the seguent:
function calculation_one
eml.extrinsic('rand',’round’);
random_number=rand(1,9);
Status_vector_cells= round(0+(99-0).*random_number);
I would like please to know:
-If the two function are in the list of supported Matlab functions for RTW code generation;
-if it is possible to know where can I find the list of supported Matlab functions for RTW, as I have looked long without find it;
-If these two functions are not supported, is there any other way to generate random number through m file? I have tried with the Simulink block “Random Source” or “Random Number”, and the generation code does not give any error, but I would prefer to use some Matlab code that is then implementable inside Stateflow through the embedded Matlab function;
Can somebody help me?
I am using Matlab 2009b 32bit with a multi core PC.
Really Thanks In advance
Andrea
Accepted Answer
More Answers (1)
Andrea
on 15 Aug 2013
0 votes
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!