Why do I receive a segmentation violation when I use the CLABEL or IMCROP command with the 'manual' option in MATLAB 6.1 (R12.1)?

1 view (last 30 days)
Why do I receive a segmentation violation when I use the CLABEL or IMCROP command with the 'manual' option in MATLAB 6.1 (R12.1)?
When executed all at once, the following code will produce a segmentation violation.The crash has only been seen to occur when there is a colorbar in the figure, and when the code is all executed at once:
[c,h] = contour(peaks);
colorbar;
clabel(c,h,'manual');
------------
Segmentation violation detected at Mon May 06 10:28:11 2002
------------
Configuration:
MATLAB Version: 6.1.0.450 (R12.1)
Operating System: Microsoft Windows 2000
Window System:Version 5.0 (Build 2195: Service Pack 1)
Processor ID: x86 Family 6 Model 8 Stepping 6, GenuineIntel
Virtual Machine:Java 1.1.8 from Sun Microsystems Inc.
Register State:
EAX = 00000000EBX = 1e477860
ECX = 1e0a2be0EDX = 01495300
ESI = 014953f4EDI = 1e1cf2f8
EBP = 014952a8ESP = 014952a8
EIP = 0170a772FLG = 00010206
Stack Trace:
[0] hg.dll:_uitoggletoolEnablePostSet(0x1e1cf2f8, 0x1e477860, 0x014953f4, 0x1e477800) + 18 bytes
[1] hg.dll:public: virtual bool __thiscall HGPropertySetListener::execute(class UDEvent *)(0x01495368, 0x1e1cf2f8, 0x094cf920, 0x01495368) + 71 bytes
[2] udd.dll:public: bool __thiscall UDListenerList::execute(class UDEvent *)(0x01495368, 0x0149531c, 0x0187b9a9, 0x1e0a2be0) + 91 bytes
[3] udd.dll:public: virtual void __thiscall UDListenerManagerHost::notifyEvent(class UDDatabaseClient *,class UDEventSource const *,class UDEventInfo const *,class UDEvent *)(0x1e0a2be0, 0x094cf920, 0x1dd12c58, 0x01495368) + 52 bytes
[4] udd.dll:public: void __thiscall UDInterface::notifyPropEvent(class UDDatabaseClient *,class UDPropInfo const *,class UDEventInfo const *,class UDEvent *)(0x1e0a2be0, 0x094cf920, 0x1dd12c58, 0x01495368) + 57 bytes
[5] udd.dll:public: void __thiscall UDInterface::setE(class UDDatabaseClient *,class UDPropInfo *,void *,class UDErrorStatus *)(0x1e0a2be0,
[snip]

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This has been fixed in MATLAB 6.5 (R13).
If you are using a previous version, after placing a colorbar in a figure
and trying to manually set clabels or crop an image, MATLAB will produce
a segmentation violation. This only occurs when the code is run all at
once, such as in a function or script file. This is probably because
MATLAB is trying to call commands on graphics objects that may not have
been rendered yet.
To workaround the problem in MATLAB 6.1 (R12.1), you can force MATLAB to
flush its graphics queue before creating the clabels or cropping the image
by using the DRAWNOW command.
For example:
[c,h] = contour(peaks);
colorbar;
drawnow
clabel(c,h,'manual');
or
imshow('flowers.tif');
colorbar;
drawnow;
imcrop;

More Answers (0)

Categories

Find more on Colormaps 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!