Creating a waitbar



Hi

I have a problem here a number of multiple files interacting with
one another. What I created is a analyzer screen . I added a list of
files to be processed by clicking the add button... when i clicked
the Go processing button in the analyzer full screen a dialog box
opens up with Stop processing..the script gets executed... When I
clicked the stop processing button the script does n't stop
executing... What it would be nice is to stop processing
immediately,at the same time a waitbar should show up when the Go
button is pressed......and be halted when the stop dialog box is
pressed.....

Can someone help me in this.... I think there seems to be a problem
in this code rundatascript starting from section stop_button...

function [dataout, exitcode, scriptmessages] = runDataScript(varargin
)
% runDataScript executes the script commands for a data set
%
% SYNOPSIS:
% A data structure containing a field of matlab commands 'scriptcmds'

% is excecuted flexibly, storing the output data as fields
% in the output structure. It allows exessive processing to be
% delayed from experiment times to later batch processing.
%
% USE:
% [dataout, exitcode] = runDataScript(...input args...)
% dataout: the output data structure
% exitcode: 1 if script executed successfully, -1
% if there were errors, and 0 if execution
% was stopped or there are still scheduled
% commands to run.
% input arguments: Arguments are either single string
% options: -
% 'status' do not execute script but simply display
% the commands. The input data is returned.
% or argument pairs: -
% ... , <option string>,<option value>, ...
% 'data' input data structure
% 'datafile' filename for input data structure in a
% .mat file.
% 'addcmd' add a command to the end of the script.
% 'lines2exe' the line numbers to execute this time.
% (N.B. Ignores whether they have been
% previously executed).
% 'doall' excutes all the lines, scheduling first if
% necessary.
%
% Commands specific to certain field names:
% 'plxfilepath' if there is a field 'plxfiledetails' (see
% below) the existing path will be replaced by
% the given string. This allows the path of files
% to be read in to be changed if the data is
% no longer where it was first specified.
%
% COMMENTS:
% expfundata and dataout are structures. expfundata must contain the
% 'scriptcmds' field. Output variables in the script become members
% of data out. Thus the dataout from excecution of a script
% might contain the following fields:
%
% scriptcmds
% scriptstatus: contains a pair-row for each line:
% [ line_num status ]
% line_num is the order of execution. If line_num is -1,
% it has not been scheduled for execution yet. This allows
% 'inactive' script lines.
% status is: 0 - not yet executed; 1 - executed sucessfully
% -1 or some other negative number - error.
% If scriptstatus does not exist, commands are executed
% in their order of appearance.
% N.B. lines2exe refers to the 'line_num' values, but it
% ignores any status values, executing the line numbers listed
% reagrdless of their status.
%
% This function is designed to facilitate flexible batch processing
% of plexon files. There a number of loosely defined fields. Names
% are not crucial unless specified
% plxfiledetails: the output from getPLXFileDetails
% The contains the fields:
% filename: cell array of file names
% startint: 1st interval in file to collect.
% num_ints: the number of intervals to collect.
% In order for the 'plxfilepath' option to work this must have
% the correct name.
%
% plx: data structure of time stamps and event
.


Loading