switch statement to select a function
古いコメントを表示
I have select one out of four functions, decided by the value of variable named "Indicator", which can be applied to a matrix Y as follows
ReceivedY = isequal(Indicator,1).*Y
ReceivedY = isequal(Indicator,2).*flipud(Y)'
ReceivedY = isequal(Indicator,3).*flipud(fliplr(Y))
ReceivedY = isequal(Indicator,4).*rot90(Y,1)
I want to write a function which takes in Indicator and gives me back newY depending upon the value of Indicator
NewY = somefunction(Y,Indicator)
I option is to use switch statements...but I have to repeat this thing many times so I am reluctant to use this option. What else can I do
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Encryption / Cryptography についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!