How can I output variables from a handle function passed as param to a set function?
3 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I would like to use an output variable generated inside a handle function which is passed as parameter to a set function. I mean, I have a main code (which I haven´t added here so as not to complicate my question). In this main code,I call the function frying_pan_position_keypress(y). Then, when I press the left arrow key, eg, I calculate te variable j, and I would like to pass this variable to the main code.
This is my code:
function j=frying_pan_position_keypress(y)
set(gcf,'KeyPressFcn',{@frying_pan_movement,y});
function j=frying_pan_movement(scr,event,y)
switch event.Character
case 28
j=y-2
case 29
j=y+2
case 30
j=y-10
case 31
j=y+10
end
end
end
Lots of thanks in advance.
0 件のコメント
回答 (2 件)
Joseph Cheng
2014 年 3 月 14 日
編集済み: Joseph Cheng
2014 年 3 月 14 日
http://stackoverflow.com/questions/16613252/how-to-use-keypressfcn-in-matlab-with-a-function-already-create I think the stackoverflow thread in the link may help.
edit: did a quick mockup and maybe easiest way is to just create a global variable? Probably not the Best solution.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!