How to make the error below each other in the text box
Afficher commentaires plus anciens
Hello, guys, I am trying to have the errors below each other, and they are all in one line. Could you please see the code and give me some suggestions?
if V_breadth_min_check == 0
msg_V_breadth_min = sprintf('Error Loading Parameter V-breadth-min: %f', app.V_breadth_min);
msg = strcat(msg, msg_V_breadth_min, "%s\n%s"); % append the error message to msg
error = error + 1;
elseif V_breadth_min_check == 1
msg_V_breadth_min = sprintf('Loaded Parameter V-breadth-min: %f', app.V_breadth_min);
end
%V_breadth_max_check
if V_breadth_max_check == 0
msg_V_breadth_max = sprintf('Error Loading Parameter V-breadth-max: %f%s\n%s', app.V_breadth_max_check);
msg = strcat(msg, msg_V_breadth_max); % append the error message to msg
error = error + 1;
elseif V_breadth_max_check == 1
msg_V_breadth_max = sprintf('Loaded Parameter V-breadth-max: %f', app.V_breadth_max);
end
error_num = sprintf('# Error: %f%s\n%s', error);
msg = strcat(msg, error_num); % append the error message to msg
% error is used as a flag to see it three is any
% uploaded value vilotated the value range or type condution
if error == 0
msgbox(msg_load, 'Ship Specification Parameters is Loaded');
app.ShipSpecificationButton.BackgroundColor = [0.93,0.69,0.13];
elseif error >= 0
msgbox(msg, 'Error in Ship Specification Parameters', 'error', 'modal');
app.ShipSpecificationButton.BackgroundColor = [1.00,0.00,0.00];
end
Réponse acceptée
Plus de réponses (1)
Here is how I would do (see my some arbitrary numerical values for display):
msg_V_breadth_min = sprintf('#2 Error Loading Parameter V-breadth-min: %f \n', pi);
error_num = sprintf('#1 Error: %f \n %s \n %s \n', [pi, date, date]);
msg = error_num; % Dont use strcat!!! to append the error message to msg
msg = strcat([msg, msg_V_breadth_min]);
msgbox(msg, 'Error in Ship Specification Parameters', 'error', 'modal');
Catégories
En savoir plus sur Scope Variables and Generate Names dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

