multithreading - Nested Parallel While Loops -
i trying run 2 while loops in parallel purpose of data acquisition. program run "n" num_trials
specific trial duration each trial.
during each trial, program collect data while keeping track of trial duration. example, first trial starts collecting data @ 1 seconds , stops @ 10 seconds. process repeat rest number of trials
how can run both while loops in parallel?
basically, want method break second while loop once specified trial duration complete?
thanks in advance.
count = 0; num_trials = 5; % number of trials = 5 trials trial_duration = 10; % trial duration = 10 seconds global check check = 0; % number of trials = 1:num_trials fprintf('starting trial %i\n', i); t_start = tic; % start counting , collecting data while toc(t_start) < trial_duration % data collection while (check ~= 1) count = count +1; end end fprintf('ending trial %i\n', i); end
have tried using single loop &&
?
while (toc(t_start) < trial_duration) && (check ~= 1) % data collection count = count +1; end
Comments
Post a Comment