MATLAB Answers

Why do I receive a segmentation violation error if I open a FIG file in MATLAB 7.0.4 (R14SP2) that was created using GUIDE in MATLAB 7.6 (R2008a)?

2 views (last 30 days)
I created a GUI (FIG file) in MATLAB 7.6 (R2008a) using GUIDE. When I try to open the FIG file in MATLAB 7.0.4 (R14SP2), MATLAB crashes with a segmentation violation error.
SStack Trace:
[0] m_interpreter.dll:public: virtual void __thiscall FunctionHandleWorkspaceCI::customLoad(class mcos::COSInterfacePtr,class mcos::COSValue,class mcos::COSDataTypePtr)(4181840, 0x12d9c6a0, 0x107afb80, 0x003c4b20 "Ô._x´._x") + 401 bytes
[1] mcos.dll:public: virtual void __thiscall mcos::COSClassI::customLoad(class mcos::COSInterfacePtr,class mcos::COSValue,class mcos::COSDataTypePtr)(4181840, 0x12d9c6a0, 0x00cd4fe8 "PÏ?", 0x003c4b20 "Ô._x´._x") + 102 bytes
[2] mcos.dll:$L96755(0x00cd50c8, 3874076, 0, 0x00cd50dc "øPÍ") + 134 bytes
[3] mcos.dll:public: virtual class mcos::COSInterfacePtr __thiscall mcos::File::getInterface(unsigned int)const (0x00cd50c8, 1, 0x12d99860, 0) + 32 bytes
[4] mcos.dll:public: struct mxArray_tag * __thiscall mcos::File::convertCOSInterfaceFromMatrix(struct mxArray_tag const *)(0x12d9fc60, 0x12d99860, 0x00cd8cc8, 0x785ecc5b) + 134 bytes
[5] mcos.dll:struct mxArray_tag * __cdecl mcosConvertFromMATFileArray(struct mxArray_tag const *,struct mxArray_tag const * *)(0x12d99860, 0x00cd512c, 0x12d99860, 0x12d97d20) + 128 bytes
[6] mcos.dll:_omLoadOpaque(0x12d97d20, 0x12d99860, 0x00cd512c, 0x01c71340 "MCOS") + 24 bytes
[7] libmx.dll:int __cdecl miConvertToOpaque(struct miStreamRec_tag *,struct mxArray_tag *,struct mxArray_tag const *,struct mxArray_tag * *)(0x0f7c24e0 "IM", 0x12d99860, 0x00cd597c, 3) + 39 bytes
[8] libmx.dll:int __cdecl _HandleArrayForStream(struct miStreamRec_tag *,struct miItem_tag *,int,int)(0x0f7c24e0 "IM", 0x00cd61b8, 0, 0) + 3220 bytes
[9] libmx.dll:int __cdecl _HandleArrayForStream(struct miStreamRec_tag *,struct miItem_tag *,int,int)(0x0f7c24e0 "IM", 0x00cd6a0c, 0, 0) + 3797 bytes

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Feb 2010
The behavior occurs because of the way MATLAB 7.6 (R2008a) manages the callback functions for a GUI designed using GUIDE. In MATLAB 7.6 (R2008a), GUIs use 'function handles' to manage the callback functions. While this method is very efficient, it means that the GUIs designed in MATLAB 7.6 (R2008a) cannot be used in previous versions of MATLAB such as MATLAB 7.0.4 (R14SP2).
The workaround for this method involves removing all the function handles.
The attached MATLAB file named 'replacefcnhandles2.m' will remove all function handles for you. Save this file into the MATLAB path. Suppose you saved your GUI as 'foo.fig', run the following command at the MATLAB command prompt to convert all the function handles. (You should backup this file first as a precaution)
This will convert the GUI so that it can be opened from previous MATLAB versions. Run this in the earlier version of MATLAB as it should be noted that editing this GUI with GUIDE in MATLAB 7.6 (R2008a) will convert the callbacks back to function handles.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!