please help strfind in stateflow NOT YET SOLVED

hi all,,
i have condition using strfind in simulink and embedded matlab function.
here is my EMF:
function V=sequence(x)
%#codegen
correct= testinput(x);
if correct
V=10000;
else
V=1;
end
function correct = testinput(x)
eml.extrinsic('strfind');
correct = any(strfind((x)>4,[1 1 1 1 1]));
but still tell error: Embedded MATLAB Interface Error: Error using ==> strfind Input strings must have one row. Block Embedded MATLAB Function (#32) While executing: none
my input from simulink are: [5 5 5 5 5 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3]
*LATER I WANT DO IT IN STATEFLOW, ANYONE KNOW HOW TO DO IT IN STATEFLOW??? *
THATS WHY I TEST ON EMBEDDED MATLAB FUNCTION FIRST
PLEASE HELP...
THANK YOU VERY MUCH

 採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 7 月 10 日

1 投票

How did you make your input to Simulink as x= [5 5 5 5 5 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3]? The error message indicates that x is a column vector.
Use your value for x as an example:
>> correct = any(strfind((x')>4,[1 1 1 1 1]))
??? Error using ==> strfind
Input strings must have one row.

3 件のコメント

Luhur
Luhur 2011 年 7 月 10 日
i use constant block and write that [5 5 5 5 5 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3]
how it should be fang??
Fangjun Jiang
Fangjun Jiang 2011 年 7 月 10 日
In your EML, try correct = any(strfind((x')>4,[1 1 1 1 1]))
Luhur
Luhur 2011 年 7 月 11 日
OH MY GOD!! WORKS!! THANKS FANG!! THANKS A LOT!!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEvent Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by