Interesting and important answer to know. How can I pass warning information in event function?

Hi,I am using ode15s to solve s system of ode. When I solve it, it comes up with a warning like ' unable to meet integration tolerance at t= ... etc.' in few time steps but still gives the solution for the rest of the time. I need to stop integration whenever a warning ( of any types) comes up and then restart the solver. But I don't know how to pass warning information to event function. I tried this as below:
[value isterminal direction]= event_func (t,y) [msgstr msgid] = lastwarn; if ~isempty(length(msgid)) value = 0; isterminal = 1; direction =0; end
But this does not work. Could any of you help me, please? Its an important issue for me

Answers (0)

This question is closed.

Products

Asked:

on 11 Oct 2013

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!