how to update progress gauge based on analyze progress in App designer GUI ?
4 views (last 30 days)
I am trying to use a gui to go through some data and analyze segments of them.
I am able to select different segments using a spinner which value is then used to "cut" segments from my data: if spinner value =1 then take the first 100 points, if equals 2 the second 100, etc. each segment is one minute.
at the end of each minute analysis, I made a save button which is suppose to store some data back in the workspace as variables. In addition to that (which I have not yet implemented), I would like this button to calculate how much of my analysis is left by taking the spinner value, store it somewhere and - based on the total amount of segments set in a text box somewhere else - it should give out a % of progress onto a "gauge bar". I have already tried to create a "storing" variable in the app but it does not work: there is no place where I could initialize the variable (creating an empty array for instance) to which then I could append values... so I thought maybe I could use the work space for this and append spinner values to a "storing variable" and then read the storing variable to calculate a progress percentage. however it seems I can 't really create new vars in the workspace (I know the assignin function but somehow I get an error when I tried to create a new var from the app).
this is my code
function savedataButtonPushed(app, event)
value = app.selectminuteSpinner.Value; % reads value from the spinner
REC = app.RECdurationminTextArea.Value; % read value from a text box in which the total duration of the analysis (i.e. the tot number of segments to analyze) is set
completion = (str2double(value)/str2double(REC))*100; % up to this line should work but should give the wrong % since it reads only one value and does not consider the history
% however it seems I can't read the value of completion and apply it directly to the gauge: is not read as a number, even though I am converting it to double
assignin('base',valuew,app.selectminuteSpinner.Value); % here is my attempt to save values in the workspace, which fails
assignin('base',RECw,REC); % same as above
app.Gauge.Value = str2double(completion); % this does not work because somehow the format of 'completion' is wrong