progressbar() issue, fails after one iteration
古いコメントを表示
Hello!
I downloaded and ran progressbar() today to replace waitbar() with the following code:
FILE_LENGTH = 5000; % Assume that 5,000 is large enough
complete_waveforms = zeros(FILE_LENGTH,4,num_selections);
sample_interval = zeros(1,num_selections);
%max_waveforms = zeros(4,num_selections);
progressbar(1);
for n = 1:num_selections
% waitbar(n/num_selections,'Reading files');
progress_counter = n/num_selections;
progressbar(progress_counter,'Reading files');
[~,~, fExt] = fileparts(file_names(n,:));
switch fExt
case '.TXA'
% A TXA file
[~, ~, this_waveform, ~, ~] = read_msp_txa_file_v1(path_to_file, file_names(n,:));
% Component order in waveforms is: Time T V L Mic
sample_interval(n) = this_waveform(2,1) - this_waveform(1,1);
complete_waveforms(:,:,n) = this_waveform(:,2:5);
case '.txt'
% A txt file
[~, ~, this_waveform, ~, ~] = read_geosonics_txt_file_v3(path_to_file, file_names(n,:));
% Component order in waveforms is: Time L T V Mic
sample_interval(n) = this_waveform(2,1) - this_waveform(1,1);
complete_waveforms(:,:,n) = [circshift(this_waveform(:,2:4),2,2) this_waveform(:,5)];
otherwise % Under all circumstances SWITCH gets an OTHERWISE!
error('Unexpected file extension: %s', fExt);
end
end
num_selections is predefined. When I run with a debug on the "progress_counter =..." line and n = 1, it progresses, but when I step to n=2, it fails on progressbar(...) with the following output:
Error using matlab.graphics.primitive.Patch/set
Input XData value must be numeric.
Error in progressbar (line 270)
set(progdata(ndx).progpatch, 'XData', ...
Error in va2_46>go_button_Callback (line 427)
progressbar(progress_counter,'Reading files');
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in va2_46 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)va2_46('go_button_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
n just steps normally and progress_counter is just a fractional number. This worked fine with waitbar(), but just wasn't as pretty, was kind of jerky, and left many windows around.
Any thoughts on this issue, or how to clean up after waitbar()?
Thanks
Doug
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で App Building についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!