Why do I receive a segmentation violation when I use the Profiler on code that involves anonymous functions in MATLAB 7.0 (R14)?

1 view (last 30 days)
I use the following command to start the Profiler:
profile on
Then I type the following line of code:
[x,fval]=fmincon(@(x) sin(x),0,[],[],[],[],-1,1);
I highlight the above code, then press the right mouse button, and choose "Evaluate Selection" from the context menu. I receive the following segmentation error:
------------------------------------------------------------------------
Segmentation violation detected at Tue Feb 15 13:58:04 2005
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.0.0.19901 (R14)
Operating System: SunOS 5.8 Generic_108528-23 sun4u
Window System: Sun Microsystems, Inc. (6410), display :0.0
Current Visual: 0x22 (class 4, depth 24)
Virtual Machine: Java 1.4.2_02 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
(mixed mode)
Default Charset: US-ASCII
Register State:
g0 = 00000000 o0 = 013dab60 l0 = 00000000 i0 = 0000000c
g1 = 013daa70 o1 = 00000914 l1 = a4fceac0 i1 = 0167b3a0
g2 = ff31365c o2 = 00033c0c l2 = feebd4ac i2 = 002af4cc
g3 = 013c16f8 o3 = fefe4a0c l3 = 00000001 i3 = fec8a444
g4 = 00000000 o4 = ff30c0f4 l4 = 00000000 i4 = fef20ba8
g5 = 00000000 o5 = 00000800 l5 = 00000000 i5 = 013daa70
g6 = 00000000 sp = ffbed8d8 l6 = 00000000 fp = ffbed938
g7 = 000220b8 o7 = fec716f8 l7 = 00005800 i7 = fefe2b48
pc = 0000000c psr = fe001004
Stack Trace:
[0] 0x0000000c(11, 139448, 0, 0)
[1] libmwm_interpreter.so:void nonMProfiler::log_function_exit(Mfh_MATLAB_fn*)(12, 0x0167b3a0 "__rwstd::__rb_tree<int,int,__rws..", 2815180, 0xfec8a444) + 40 bytes
[2] libmwm_dispatcher.so:void Mfh_file::dispatch_fh(int,mxArray_tag**,int,mxArray_tag**)(0xfef2ac54 "þëÓ0", 1, 0xfec716d0, 0xfef2a4c8) + 568 bytes
<snip>

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This problem has been fixed in MATLAB 7.0.1 (R14SP1). If you are using an earlier version of MATLAB, read the following:
We have verified that there is a bug in MATLAB 7.0 (R14) when using the Profiler with anonymous functions. To work around this issue, do not use the "Evaluate Selection" feature. For example, the following code does not cause a segmentation error:
profile on
[x,fval]=fmincon(@(x) sin(x),0,[],[],[],[],-1,1);
profile viewer
This will bring up the Profiler Window, which displays the Profile Summary.

More Answers (0)

Categories

Find more on MATLAB Report Generator in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!