Receive value in Matlab GUI
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!