outputs in my function
Show older comments
Hello,Im need to use the output "a" in other function who calls testkeyboard, but when i do it, occurs the next error:
Output argument "rueda1" (and maybe others) not assigned during call to
this is the code of testkeyboard:
function [rueda1,rueda2,rueda3]=testkeyboard
figure('KeyPressFcn',@printfig);
function [rueda1,rueda2,rueda3] =printfig(~,event)
% Callback to parse keypress event data to print a figure
if event.Character == 'w'
rueda2=0;
rueda1=1;
rueda3=0;
elseif event.Character == 's'
rueda2=0;
rueda1=-1;
rueda3=0;
elseif event.Character == 'a'
rueda2=-1;
rueda1=0;
rueda3=0;
elseif event.Character == 'd'
rueda2=1;
rueda1=0;
rueda3=0;
elseif event.Character == 'i'
rueda2=0;
rueda1=0;
rueda3=1;
elseif event.Character == 'k'
rueda2=0;
rueda1=0;
rueda3=-1;
elseif event.Character == 'j'
rueda2=-1;
rueda1=-1;
rueda3=-1;
elseif event.Character == 'l'
rueda2=1;
rueda1=1;
rueda3=1;
else
rueda2=0;
rueda1=0;
rueda3=0;
end
disp(fprintf('rueda1= %d', rueda1));
disp(fprintf('rueda2= %d', rueda2));
disp(fprintf('rueda3= %d', rueda3));
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Alignment in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!