Clear Filters
Clear Filters

How to add waitbar to matlab gui with daq?

3 views (last 30 days)
Ali Albaidhani
Ali Albaidhani on 16 Feb 2022
Edited: Rik on 16 Feb 2022
Hello everyone,
I'm making a gui to control sending signals through a daq system from ni.
Sending a signal through the system and reciving it back takes time, and im tying to make this time visible through a waitbar.
Now i've looked up some examples on how to use waitbar and how to embedded it with gui, but i didn't learn much and it still complicated to me.
Here is a section of the program:-
%----------------------------------------------------------------------------
addinput(dq, "Dev2", "ai10", "Voltage");
addoutput(dq, "Dev2", "ao0", "Voltage");
TEST =A* chirp(t,x1,t1,x2);
%--------------------
axes(handles.axes1);
ao=TEST.*t
plot(t, ao,'linewidth',2);
grid on
title('Signal im Zeitbereich')
xlabel('t (s)')
ylabel('A (V)')
%----------
setappdata(0 ,'TEST',TEST)
setappdata(0 ,'t',t)
%----------
ao=ao'
data=readwrite(dq,(ao));
axes(handles.axes2);
plot(data.Time, data.Variables,'linewidth',2 )
title('Daten im Zeitbereich')
xlabel('t (s)')
ylabel('A (V)')
grid on
%----------
setappdata(0 ,'Data',data)
%----------
%----------------------------------------------------------------------------
If needed i can also attach the full program.
Regards,
Ali
  5 Comments
Ali Albaidhani
Ali Albaidhani on 16 Feb 2022
Thanks Rik,
The only problem here, is that im a beginner and i don't really know how to reimplement the waitbar.
I also don't know how to store the data the way you said, i just made a small google search and it showed me to store it that way and it is working fine till now.
Rik
Rik on 16 Feb 2022
Edited: Rik on 16 Feb 2022
Did you read the link I posted? Did you read the documentation for the patch function? If you simply have one side of an axes filled with a color, that looks like a progress bar. There are probably also dozens of progress bars on the file exchange.
As for the data: did you read the link I posted? Did you read the documentation for the guidata function? Or for the setappdata function?
It works fine for now, but once you run a second instance it will cause strange problems. Or if you create a second thing and run both of them at the same time. The fact that it works now is not really related to the whether it is a good idea.
Everybody starts out as a beginner. It is your choice whether you want to stay a beginner. Read the documentation and read the links with long advice threads. They contain a lot of advice.

Sign in to comment.

Answers (0)

Categories

Find more on Dialog Boxes 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!