MatLab memory allocation when max size is unknown

后端 未结 3 481
不知归路
不知归路 2021-01-14 04:34

I am trying to speed up a script that I have written in Matlab that dynamically allocates memory to a matrix (basicallly reads a line of data from a file and writes it into

3条回答
  •  情书的邮戳
    2021-01-14 05:15

    To solve your error, simply use this syntax when allocating

    data = [data; zeroes(1000, size(data,2))];
    

    You might want to read the first line outside the loop so you'll know the number of columns and make the first allocation for data.

提交回复
热议问题