Receive value in Matlab GUI
Show older comments
Hello I'm working with Matlab GUI using GUIDE about show status from arduino(Ex:degree,current) and I have .m file program in Matlab to calculate and read variables when I press 'Start' button. I want program to receive realtime variables. Is there any way to do to make it work? I already try to get variables but It just give me only first time value. Here is my example of my .m file
function [B1, B2, B3, B4] = LogDataB(arduino)
mode=2;
fopen(arduino);
while mode
fprintf(arduino,'%s',1);
if(mode>=1)
B1=fscanf(arduino,'%d');
B2=fscanf(arduino,'%d');%Bx
B3=fscanf(arduino,'%d');%By
B4=fscanf(arduino,'%d');%Bz
end
mode=mode-1;
end
fclose(arduino);
Any idea please.
Thank you
Math
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!