各位老师:您好!

为了提高Matlab程序的执行速度,我尝试用Matcom将m文件编译成cpp文件,编译时发现在mat2cell.m中有如下错误:
“Error C:\MATLAB6p5\toolbox\matlab\datatypes\mat2cell.m 207: 'ref{inc} = ref{inc}(end);' end used outside an index”。

在212行同样用到ref{inc} = ref{inc}(end)+……

因为我对Matlab的这种用法不熟,所以不知道如何将他们改写。请各位高手拨冗释教,本人将不胜感激。

我把程序中207行前后的这一段语句复制如下:
   203     % If we are adding an empty matrix when updating this increment's
   204     %   reference, then add 0 instead, but index with [], and set the
   205     %   REFSTATIC tracker.
   206     if ~varargin{inc}(dimcounts(inc))
   207         ref{inc} = ref{inc}(end);
   208         refstatic(inc) = 1;
   209     else
   210         % When updating an increment's reference without adding 0,
   211         %   reset the REFSTATIC tracker
   212         ref{inc} = ref{inc}(end)+[1:varargin{inc}(dimcounts(inc))];
   213         refstatic(inc) = 0;
   214     end

再次谢谢。

Dcxyzuv
2008/01/31