MATLAB: Do I receive an assertion when I specify the property “xdatasource” in PLOT

assertionMATLABplotr14xdatasourceydatasourcezdatasource

The code
z = 1:10;
plot(1:10,'xdatasource',z)
gives the following error:
Caught unexpected exception of unknown type.
------------------------------------------------------------------------
Assertion detected at Fri Dec 03 13:35:07 2004
------------------------------------------------------------------------
Assertion failed: hdr->in_use != 0, at line 736 of file ".\memmgr\memcache.cpp".
Attempt to free previously freed memory
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License: DEMO
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 1)
Processor ID: x86 Family 15 Model 2 Stepping 9, GenuineIntel
Virtual Machine: Java 1.4.2_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
(mixed mode)
Default Charset: ibm-5348_P100-1997
Stack Trace:
[0] bridge.dll:_mnSignalHandler(0xffffffff, 0, 0, 0x79c99b80) + 303 bytes
[1] bridge.dll:void __cdecl ThrowAssertion(void)(0x014269a8, 0x78775a88, 0x65737341, 0x6f697472) + 164 bytes
[2] bridge.dll:void __cdecl MATLABAssertFcn(char const *,char const *,int,char const *)(0x7874d4ec ": hdr->in_use != 0,", 0x7874d328 ".\memmgr\memcache.cpp", 736, 0x7874c590 "Attempt to free previously freed..") + 110 bytes
[3] libut.dll:_mw_free(0x014269b0 "__ehhandler$??0sentry@?$basic_os..", 0x00cdf380, 0x7879284e, 0x014269b0 "__ehhandler$??0sentry@?$basic_os..") + 584 bytes
[4] libut.dll:_utFree(0x014269b0 "__ehhandler$??0sentry@?$basic_os..", 0, 0x013aa210, 0x00cdf390 "¨óÍ") + 100 bytes
[5] libmx.dll:void __cdecl mxDestroyArrayContents(struct mxArray_tag *)(0x013aa210, 0x0f3de6d8, 0x00cdf3a8 "¸óÍ", 0x787b40ab) + 174 bytes
[6] libmx.dll:_mxDestroyArray(0x013aa210, 1, 0, 0x00cdf438 "èôÍ") + 50 bytes
<snip>

Best Answer

This bug has been fixed in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
There is a bug in MATLAB 7.0 (R14) in the way that the "xdatasource", "ydatasource" and "zdatasource" properties of lineseries objects are handled when the value for the property is not a string or a variable of type char.
To work around this issue, set these properties with a string as in the following code:
z = 1:10;
plot(1:10,'xdatasource','z')