warning messages usually don't interrupt the simulation of a script in matlab, but I need to do it. Specifically I need to interrupt my simulations after the message 'Warning: Matrix is singular to working precision'. How can I do it? Is there a condition 'if warning' o something similar?
|
|
0
|
|
|
|
Reply
|
Niccolo
|
5/14/2010 12:50:21 PM |
|
Not sure, but you may want to have a look at the command dbstop
"Niccolo' Bulgarini" <n.bulgarini@gmail.com> wrote in message <hsjgud$8i8$1@fred.mathworks.com>...
> warning messages usually don't interrupt the simulation of a script in matlab, but I need to do it. Specifically I need to interrupt my simulations after the message 'Warning: Matrix is singular to working precision'. How can I do it? Is there a condition 'if warning' o something similar?
|
|
0
|
|
|
|
Reply
|
Fabio
|
5/14/2010 12:59:04 PM
|
|
"Niccolo' Bulgarini" <n.bulgarini@gmail.com> wrote in message
news:hsjgud$8i8$1@fred.mathworks.com...
> warning messages usually don't interrupt the simulation of a script in
> matlab, but I need to do it. Specifically I need to interrupt my
> simulations after the message 'Warning: Matrix is singular to working
> precision'. How can I do it? Is there a condition 'if warning' o something
> similar?
When you say "interrupt" do you mean "enter debug mode" or do you mean
"abort the execution of my function"?
If the former, use DBSTOP -- it has an option that tells MATLAB to stop
whenever a warning is thrown.
If the latter, check LASTWARN after your calculation that may involve a
singular matrix and use ERROR if the warning or warnings that you're looking
for have occurred.
--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
|
0
|
|
|
|
Reply
|
Steven
|
5/14/2010 1:14:19 PM
|
|
I've realized I've to do it harder: I should break a loop generated by a p-file. I'm using an optimization algorithm and a nuber is close to singular or bad scaled. since I've no access to the p-file, can I give a command before calling the p-file for breaking from that loop once a waring is encountered?
many thanks!
"Steven Lord" <slord@mathworks.com> wrote in message <hsjiba$aio$1@fred.mathworks.com>...
>
> "Niccolo' Bulgarini" <n.bulgarini@gmail.com> wrote in message
> news:hsjgud$8i8$1@fred.mathworks.com...
> > warning messages usually don't interrupt the simulation of a script in
> > matlab, but I need to do it. Specifically I need to interrupt my
> > simulations after the message 'Warning: Matrix is singular to working
> > precision'. How can I do it? Is there a condition 'if warning' o something
> > similar?
>
> When you say "interrupt" do you mean "enter debug mode" or do you mean
> "abort the execution of my function"?
>
> If the former, use DBSTOP -- it has an option that tells MATLAB to stop
> whenever a warning is thrown.
>
> If the latter, check LASTWARN after your calculation that may involve a
> singular matrix and use ERROR if the warning or warnings that you're looking
> for have occurred.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>
|
|
0
|
|
|
|
Reply
|
Niccolo
|
5/14/2010 2:03:07 PM
|
|
Dear Niccolo!
> I've realized I've to do it harder: I should break a loop generated by a p-file. I'm using an optimization algorithm and a nuber is close to singular or bad scaled. since I've no access to the p-file, can I give a command before calling the p-file for breaking from that loop once a waring is encountered?
P-files can be easily influenced by creating M-files with the called subfunctions in the same directory. So if your warning is created e.g. in the function LU, create a new file called "lu.m" in the same directory as your P-file:
----------------------------------------
% Please adjust the number of outputs etc to your special problem.
function [L, U, P, Q] = lu(varargin)
[L, U, P, Q] = builtin('lu', varargin{:});
if ~isempty(lastwarn)
error(lastwarn);
end
-----------------------------------------
Then you can enclose the call to your optimization in a TRY CATCH block.
Use this to find the function which causes the warning:
dbstop if warning
Good luck, Jan
|
|
0
|
|
|
|
Reply
|
Jan
|
5/14/2010 2:24:05 PM
|
|
"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <hsjme5$d8h$1@fred.mathworks.com>...
> Dear Niccolo!
>
> > I've realized I've to do it harder: I should break a loop generated by a p-file. I'm using an optimization algorithm and a nuber is close to singular or bad scaled. since I've no access to the p-file, can I give a command before calling the p-file for breaking from that loop once a waring is encountered?
>
> P-files can be easily influenced by creating M-files with the called subfunctions in the same directory. So if your warning is created e.g. in the function LU, create a new file called "lu.m" in the same directory as your P-file:
>
> ----------------------------------------
> % Please adjust the number of outputs etc to your special problem.
> function [L, U, P, Q] = lu(varargin)
> [L, U, P, Q] = builtin('lu', varargin{:});
> if ~isempty(lastwarn)
> error(lastwarn);
> end
> -----------------------------------------
>
> Then you can enclose the call to your optimization in a TRY CATCH block.
> Use this to find the function which causes the warning:
> dbstop if warning
>
> Good luck, Jan
good stuff... yet, it does not completely solve the OP's problem as he/she still does not get access to the built-in...
us
|
|
0
|
|
|
|
Reply
|
us
|
5/14/2010 2:47:04 PM
|
|
another problem is that I receive this message:
Warning: Matrix is singular to working precision.
> In /home ... optim/optim/private/backsolveSys.p>backsolveSys at 11
In /home ...optim/optim/private/solveKKTsystem.p>solveKKTsystem at 9
In /home ...optim/optim/private/computeTrialStep.p>computeTrialStep at 60
In /home ...optim/optim/barrier.p>barrier at 275
so I don't know neither which input & output arguments has the backsolveSys.p function!
"us " <us@neurol.unizh.ch> wrote in message <hsjnp8$btk$1@fred.mathworks.com>...
> "Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <hsjme5$d8h$1@fred.mathworks.com>...
> > Dear Niccolo!
> >
> > > I've realized I've to do it harder: I should break a loop generated by a p-file. I'm using an optimization algorithm and a nuber is close to singular or bad scaled. since I've no access to the p-file, can I give a command before calling the p-file for breaking from that loop once a waring is encountered?
> >
> > P-files can be easily influenced by creating M-files with the called subfunctions in the same directory. So if your warning is created e.g. in the function LU, create a new file called "lu.m" in the same directory as your P-file:
> >
> > ----------------------------------------
> > % Please adjust the number of outputs etc to your special problem.
> > function [L, U, P, Q] = lu(varargin)
> > [L, U, P, Q] = builtin('lu', varargin{:});
> > if ~isempty(lastwarn)
> > error(lastwarn);
> > end
> > -----------------------------------------
> >
> > Then you can enclose the call to your optimization in a TRY CATCH block.
> > Use this to find the function which causes the warning:
> > dbstop if warning
> >
> > Good luck, Jan
>
> good stuff... yet, it does not completely solve the OP's problem as he/she still does not get access to the built-in...
>
> us
|
|
0
|
|
|
|
Reply
|
Niccolo
|
5/14/2010 3:30:22 PM
|
|
Dear Urs!
> > P-files can be easily influenced by creating M-files with the called subfunctions in the same directory. So if your warning is created e.g. in the function LU, create a new file called "lu.m" in the same directory as your P-file:
> >
> > ----------------------------------------
> > % Please adjust the number of outputs etc to your special problem.
> > function [L, U, P, Q] = lu(varargin)
> > [L, U, P, Q] = builtin('lu', varargin{:});
> > if ~isempty(lastwarn)
> > error(lastwarn);
> > end
> > -----------------------------------------
> >
> > Then you can enclose the call to your optimization in a TRY CATCH block.
> > Use this to find the function which causes the warning:
> > dbstop if warning
> >
> > Good luck, Jan
> good stuff... yet, it does not completely solve the OP's problem as he/she still does not get access to the built-in...
>
> us
Correct! Damn, I'm still thinking in Matlab 6.5, where built-in's are called instead of functions in the local directory.
For Matlab 2009a I find this behaviour:
I create test.m in a folder in the Matlab path:
% File D:\MFiles\test.m --------------------
function [L, U] = test(X)
which('lu')
[L, U] = lu(X);
% --------------------
% File D:\MFiles\lu.m --------------------
function [L, U] = lu(X)
disp('my lu')
[L, U] = builtin('lu', X);
% ---------------------
The WHICH command replies correctly:
D:\MFiles\lu.m
but it does not call the local lu! "my lu" does not appear in the command window. When I make this folder the current directory, a warning appears, that "the same name exists as a MATLAB builtin". But my local lu is not called neither after cd('D:\MFiles') nor after cd(elsewhere).
Moving D:\MFiles to the initial position in the path does not help.
This is conform with the documentation, because lu is an overloaded function for @double and @single, and overloaded function have the precedence 5, M-files in the current directory come at position 6, and M-files on the path and built-in's at the last position 7.
E.g. STRCMP in the same folder *is* called instead of Matlab's builtin function. If you create a @char/strcmp.m anywhere in the path, then the local STRCMP is not called anymore!
Then I tried moving the personal lu to the subfolder D:\MFiles\private\ and it works as expected and wanted: "test" calls \private\lu, \private\lu calls built-in lu. Private functions have the precedence 3...
This private\ method allows bypassing all functions (except for the 20 keywords - see ISKEYWORD) called by P-files and this is the cause for the very limited privacy/security level of the P-coding.
@OP: Please create the man-in-the-middle-attack function in a the subfolder private\ . Or ask the author to ship the M-file.
Jan
|
|
0
|
|
|
|
Reply
|
Jan
|
5/14/2010 4:34:05 PM
|
|
|
7 Replies
181 Views
(page loaded in 0.046 seconds)
Similiar Articles: Boot hangs on "Setting default IPv4 interface" - comp.unix.solaris ...... it says "WARNING: asppd has bee superseded; see pppd(1m). After that, I get two "NIS domainname is <domainname>" messages ... message comes, after which the ... A Stop A should ... Skip or interrupt startup script - comp.databases.filemaker ...Bill <ads@mayogenuine.com> wrote in message news:1107144730.797306.44020 ... eDrawings 2005 won't close down - comp.cad.solidworks Skip or interrupt startup script ... Interrupt Boot Process on HP 382 Workstation running HP-UX 9.10 ...Reboot system. e.g. # reboot Well, technically: a) the steps after ... running HP-UX 9.10. dgrcos_at_yahoo.com Date: 12/16/04 Next message: Frank Slootweg: "Re: Interrupt ... How do I show all compiler warnings with Sun Studio? - comp.unix ...... none, %all, <tag list>) as errors -w Suppress compiler warning messages ... compiling and some checking between cc and lint. gcc tries to be a one stop ... AxAcroPDF.printAll() and WARNING! - comp.text.pdfI can dismiss the warning dialog box checking "Do not show this message again". This is a good decision, but is there a way to prevent this message? how to re-read a partition table on Solaris? - comp.unix.solaris ...... warning" message after the "new" "low level drive/raid management application takes over", sometimes when everything works correctly you may yet get a "warning" message. nvram area is corrupt.. - comp.dcom.sys.ciscoYou should be able to boot into rom monitor (issue a break at the console at ... victor@cantv.net (Victor Cappuccio) >wrote: > >>Hello Captain. >> >>The warning messages ... WARNING: ata_controller - Set features failed - comp.unix.solaris ...SUNWspro/bin/cc -flags | grep -i warning ... they use a flag to gcc to suppress warning messages from the assembler. That failed ... real code to exhibit these features is ... how to stop SAS jobs - comp.soft-sys.sasHi, I am running a certain code and would like to ask SAS stop all later jobs if ... Abend code */ 8 ,msg1=3D /* Message 1 */ 9 ,msg2=3D /* Message 2 ... Warning: Could not query OpenGL - comp.soft-sys.matlabEverytime I try and start ML7, the following warning pops up: Warning: Could not query OpenGL Any ideas what it's talking about and how I can stop t... How to Disable the Security Warning Messages in Internet Explorer ...As many of you know I really hate unnecessary warning messages. Check out my post on how to ... You Lowered Your Internet Explorer’s Security Settings – Stop the MS Vista ... How to enable or to disable hyperlink warning messages in 2007 ...Describes how to enable or to disable hyperlink warning messages in 2007 Office programs and in Office 2010 programs. 7/24/2012 1:56:31 PM
|