Simple fnc model has error message about || and && operators

1 次查看(过去 30 天)
I get the following error message when I update a model
"Operands to the '||' and && operators must be convertible to logical scalar values."
The fnc is a simple fnc block, that takes two scalar double inputs, u(1) and u(2), and performs a math operation on them and then outputs the result to one outport block. The inputs come from two inport blocks that are followed by a mux.
What does '||' and && have to do with this? Is that part of the mux block, under the hood? If so, is a selector block needed after the mux and before the input to the simple fnc block?
  1 个评论
Kaustubha Govind
Kaustubha Govind 2011-8-15
The error looks like it could be coming from your Fcn block. Try executing "dbstop if all error" at the MATLAB prompt before updating your model to see if MATLAB breaks in the function that the error occurs at.

请先登录,再进行评论。

回答(2 个)

Stephen
Stephen 2011-8-15
Thanks, Kaustubha.
I tried your suggestion (dbstop if all error) and got the following error message:
Error using ==> getPowerguiInfo at 67.
But the model does not include a powergui block. The model is a subsystem of another model that does not include a powergui block either. However, that parent model is then part of a model that does use a powergui block. Is it possible that when a model is updated, somehow other models can affect that update?

Fangjun Jiang
Fangjun Jiang 2011-8-20
There is a difference between && and &. && applies to scalar and & applies to vector. Try the following one at a time to see the difference. Your input might not be a scalar as you expected.
1.2 && 3.5
[1 2] & [3 4]
[1 2] && [3 4]

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by