Clear Filters
Clear Filters

What is SetSimViewingDevice?

11 views (last 30 days)
What is SetSimViewingDevice and how can I set it to false in the hope of compiling the serial receive block in Simulink?

Accepted Answer

Abhi Sundararaman
Abhi Sundararaman on 26 Jul 2017
Unfortunately, the serial send/receive blocks from the Instrument control toolbox are not supported for code generation. Therefore, even if you could set the "SetSimViewingDevice" parameter to "false", it would not allow code generation. Instead, you would get a different error.
To answer your initial question about "what is setsimviewingdevice": This is a parameter that is used to prevent S-functions from having code generated for them. If you were to write your own S-function, but you wanted this block to be "skipped" in code generation, you would set the value of "SetSimViewingDevice" to "true". The most likely reason you encountered this parameter with respect to the Serial Receive block is because this block is coded as an S-function under the hood, and we set this parameter to be "true" so the compiler does not try to generate code for this (because it would fail otherwise).
So to summarize, changing the value of this parameter would unfortunately still not allow the block to be compiled. The main workaround for this limitation would be to write a custom block for this functionality using your own S-function.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!