Borrar filtros
Borrar filtros

How do I removed warning dialog popups?

4 visualizaciones (últimos 30 días)
Daniel el 6 de Oct. de 2014
Editada: Andrew Reibold el 9 de Oct. de 2014
I'm working on a bit of code that was made by some people a few years back and I've been trying to removed some warning dialog pop ups. The only way I could think of was to just comment the code involving them out but when I do that and then launch the program, them pop ups still occur. Any idea how I fix this?
Also, here is the code.
% --- Executes on button press in start_button.
function start_button_Callback(hObject, eventdata, handles)
target_pc_struct = get(handles.connect_button, 'UserData');
target_obj = target_pc_struct.target_obj;
% Check if the target computer application is already running. If so, do nothing aside from
% alerting the user.
task_flag = 0;
if (strcmp(target_obj.Status, 'running'))
warndlg('The target application has already been started.', 'Application already running', 'modal');
% Get the default sample position parameters and reset (initialize) them in the model.
task_flag = 1;
build_params = target_obj.getparam(target_obj.getparamid('Build-dependent physical parameters', 'Value'));
model_params = getConfigurations('ECHTGAIN_MODEL_PARAMETERS');
target_obj.setparam(target_obj.getparamid('x_pos', 'Gain'), 0);
target_obj.setparam(target_obj.getparamid('y_pos', 'Gain'), 0);
target_obj.setparam(target_obj.getparamid('z_pos', 'Gain'), build_params(3)/2);
target_obj.setparam(target_obj.getparamid('Time Const 1', 'Gain'), 1/model_params.horizontal_time_constant);
target_obj.setparam(target_obj.getparamid('Time Const 2', 'Gain'), 1/model_params.vertical_time_constant);
target_obj.setparam(target_obj.getparamid('frequency', 'Gain'), model_params.default_osc_frequency);
target_obj.setparam(target_obj.getparamid('amplitude', 'Gain'), 0);
% Start the target application on the target computer and collect the start timestamp.
task_flag = 2;
time_stamp = now;
warndlg('The application was successfully started on the target computer.', 'Application started', 'modal');
% Store the timestamp on the target computer.
task_flag = 3;
target_obj.setparam(target_obj.getparamid('Initial timestamp', 'Value'), time_stamp);
% Get the sampling period of the real-time application. Display the initial timestamp and
% the sampling period. Clear the display boxes for stop timestamp, timestamp difference,
% total execution time, and number of samples computed.
tau = build_params(4);
set(handles.start_timestamp, {'String', 'UserData'}, {getDateString(time_stamp, getNumberOfDecimalDigits(tau)), time_stamp});
set(handles.sampling_period, 'String', tau);
set([handles.stop_timestamp, handles.timestamp_difference, handles.execution_time, handles.number_of_samples], 'String', '');
catch err
if (task_flag == 0 || task_flag == 2)
msg = 'Could not start the application because an error occurred while attempting to communicate with the target computer.';
elseif (task_flag == 1)
msg = 'Could not initialize the sample position parameters because an error occurred while attempting to communicate with the target computer. The application will not be started.';
elseif (task_flag == 3)
msg = 'Could not store the starting timestamp on the target computer because an error occurred while attempting to communicate with it.';
errordlg(sprintf('%s\n - Error identifier: %s\n - Error message: %s', msg, err.identifier, err.message), 'Communication error', 'modal');

Respuestas (2)

Image Analyst
Image Analyst el 6 de Oct. de 2014
Just put a % in front of every call to warndlg(). If you still get them, then you missed some.
  2 comentarios
Daniel el 9 de Oct. de 2014
I've tried this and the popups still occur.
Image Analyst
Image Analyst el 9 de Oct. de 2014
That's impossible. Just step though your code line by line until you find the line without the % that is causing the popup to occur.

Iniciar sesión para comentar.

Andrew Reibold
Andrew Reibold el 9 de Oct. de 2014
Editada: Andrew Reibold el 9 de Oct. de 2014
Use find and replace and you can't possibly miss any... :)
Ctrl+F Find: warndlg Replace: %warndlg
There are also plenty of other kinds of dialog boxes that could be coming up. These might include the functions: dialog, errordlg, helpdlg, msgbox, questdlg, etc.
Search for the text being displayed in the box. It will be in the code somewhere if it was homemade.


Más información sobre Environment and Settings en Help Center y File Exchange.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by