diff --git a/src/MagicFormulaTyreTool.m b/src/MagicFormulaTyreTool.m index d8b0004..a77038f 100644 --- a/src/MagicFormulaTyreTool.m +++ b/src/MagicFormulaTyreTool.m @@ -418,12 +418,12 @@ function onStartFittingRequested(app, ~, ~) fig = app.UIFigure; title = 'Tyre Model Fitter'; - message = sprintf(['To start fitting, the following conditions ' ... + msg = sprintf(['To start fitting, the following conditions ' ... 'must be met:' newline() ... '\t- Tyre model loaded' newline() ... '\t- Tyre data loaded' newline() ... '\t- Fit modes selected (Fx0, Fy0, Fx, ...)']); - showUserFail = @(x) uialert(fig, message, title, 'Icon', 'error'); + showUserFail = @(x) uialert(fig, msg, title, 'Icon', 'error'); tyreModel = app.TyreModel; if isempty(tyreModel) @@ -446,10 +446,10 @@ function onStartFittingRequested(app, ~, ~) fitter.Measurements = measurements; fitter.FitModes = fitmodes; - message = 'Starting Fitter...'; + msg = 'Starting Fitter...'; dlg = uiprogressdlg(fig, ... 'Title', title, ... - 'Message', message, ... + 'Message', msg, ... 'Indeterminate','on', ... 'Cancelable', 'on'); @@ -472,17 +472,17 @@ function onStartFittingRequested(app, ~, ~) close(dlg) if cancelByUser - message = 'Fitting process aborted by user.'; + msg = 'Fitting process aborted by user.'; icon = 'info'; else - message = 'Fitting process successful.'; + msg = 'Fitting process successful.'; icon = 'success'; end - message = [message newline() ... + msg = [msg newline() ... 'Parameters of last iteration written to table.' ... newline() newline() ... 'Details printed to logfile/console.']; - uialert(fig, message, title, 'icon', icon) + uialert(fig, msg, title, 'icon', icon) catch ME paramsFitted = magicformula.v62.Parameters.empty; e = events.TyreModelFitterFinished(paramsFitted); @@ -490,10 +490,32 @@ function onStartFittingRequested(app, ~, ~) close(dlg) - message = ['Fitting process FAILED!' newline()... - 'Details printed to logfile/console.']; - uialert(fig, message, title, 'icon', 'error') + cause = ME.cause; + if iscell(cause) + cause = cause{1}; + end + msg = ['Fitting process FAILED!' newline() newline()]; + switch class(cause) + case 'exceptions.NoMeasurementForFitMode' + fitmode = cause.FitMode; + msg = [msg 'Cause:' newline() ... + 'Loaded measurements do not contain ' ... + 'data for selected fitmode ''%s''. ' ... + newline() newline() ... + 'Troubleshooting:' newline() ... + 'Note that to fit ''Fx0'' ' ... + 'you require data that includes slip ratio ' ... + 'sweeps. Fitting ''Fx'' also requires slip ' ... + 'angle to be present during those sweeps. ' ... + 'Similarly, fitting ''Fy0'' requires slip ' ... + 'angle sweeps and ''Fy'' also requires ' ... + 'those sweeps at interval-fixed slip ratios.']; + msg = sprintf(msg, fitmode); + otherwise + msg = [msg 'Details printed to logfile/console.']; + end + uialert(fig, msg, title, 'icon', 'error') rethrow(ME) end end diff --git a/src/magic-formula-tyre-library b/src/magic-formula-tyre-library index 84edaa6..43ac32b 160000 --- a/src/magic-formula-tyre-library +++ b/src/magic-formula-tyre-library @@ -1 +1 @@ -Subproject commit 84edaa69b1b5d88452432a9bf1e8f6c244f41cb1 +Subproject commit 43ac32bd77e325f067a21a0d302abe21c555c89f