Is it possible to output a NaN from the signal editor block?

2 次查看(过去 30 天)
I thought I had a signal editor outputting a signal which had NaN values for some parts. In a new model I tried to do it again but I only get an error that this is not allowed.
Is it possible to output a NaN from a signal editor and I just have some block/model settings wrong? Or did I imagine that I could do it before?
Thanks!
Adam

回答(2 个)

Jonas
Jonas 2019-6-26
I don't exactly know which error your get, but maybe you just need to set the Diagnostic settings to not throw an error for NaN block outputs.

Adam S
Adam S 2019-6-26
Hey Jonas,
Thanks for the suggestion and sorry my original post was lacking in specifics and probably not so clear. Here is the actual error I get on compilation (simulation doesn't start running):
ErrorMsg.png
I did try to play with that setting you suggested in the Data Validity menu but it only changes the warning/error behaviour during a simulation.
At the moment I have a temporary solution but it is not ideal, I thought that the signal editor block could output NaN before but I can't actually find any evidence of it working for me previously so I could be incorrectly remembering the prior behaviour :)
Here is my temporary solution with the second signal generator requesting NaNs (but it is not ideal for my use case):
TempSoln.png

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by