MATLAB Answers

Force output for function with no output

40 ビュー (過去 30 日間)
Sergey Kasyanov
Sergey Kasyanov 2019 年 10 月 15 日
回答済み: Walter Roberson 2019 年 10 月 15 日
Hello!
I am working with function handles and get error because function does not return anything. Can I force any function to return something (does not mean what)?
Explainations what I do:
My handle function set some variable to Simulink.data.Dictionary with Simulink.data.dictionary.Entry.setValue and starts simulation of model. After all my handle function process result of simulation and return 2-by-1 cell array: first cell is empty because Simulink.data.dictionary.Entry does not return anything, second cell contains result of simulation. I want to save result of simulation but I can not do that. For example when I try do that I catch error:
A=FUN(x);%error occurs. Signature of Simulink.data.dictionary.Entry.setValue is mismatch but that is no true because signature is OK (believe me please).
but when I do that program work fine:
FUN(x)
A=ans;%work fine.
I think that problem is caused by no output by Simulink.data.dictionary.Entry.setValue and I want to force any output from Simulink.data.dictionary.Entry.setValue or maybe construct handle function which get another handle function then evaluate it and return empty matrix for example.

  0 件のコメント

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2019 年 10 月 15 日
No, MATLAB does not offer any way of doing that through function handles and operators.
You will need to write a small function that executes the command for you and returns something.

  0 件のコメント

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by