sinat_22822467 2015-09-21 09:45 采纳率: 16.7%
浏览 3406
已结题

急求大神帮忙啊!matlab中遇到的矩阵变量问题

v=[ ];x=[ ];a=[ ];
f=[ ];g=[ ];b=[ ];w=[ ];u=[ ];gg0=[ ];可以在matlab2013中这样编辑动态的数组变量吗?为什么会出现以下错误呢
The size of the indicated variable or array appears to be changing with each loop iteration. Commonly, this message appears because an array is growing by assignment or concatenation. Growing an array by assignment or concatenation can be expensive. For large arrays, MATLAB must allocate a new block of memory and copy the older array contents to the new array as it makes each assignment. Programs that change a variable's size in this way can spend most of their run time in this inefficient activity.
翻译为:显示变量或数组的大小与每个循环迭代似乎正在改变。一般,这个消息似乎因为增加数组赋值或连接。增长数组赋值或连接可以是昂贵的。对于大型阵列,MATLAB必须分配一个新的块内存和年长的数组内容复制到新数组,因为它使每个任务。程序,以这种方式改变一个变量的大小可以花大部分运行时间在这种低效率的活动。

  • 写回答

2条回答 默认 最新

  • _cycycyc 2015-09-21 12:23
    关注

    这个应该是warning吧,可以这么写只不过可能效率低一点,因为动态增长数组可能会需要重新分配内存。

    评论

报告相同问题?