[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading file

From: Kire Pudsje
Subject: Re: Reading file
Date: Thu, 22 Dec 2016 20:22:25 +0100

Agree with the XY-problem.
Anyway, when speed is important, never grow an array inside a loop by appending. Pre-allocate a decent amount of memory and only increase in chunks when necessary. When outside the loop, cut the array to size.
Do you really need a 2D array? Try reading it as one big string (as suggested) and use strsplit to obtain a cell array of strings.

2016-12-22 19:57 GMT+01:00 Andreas Weber <address@hidden>:
Am 22.12.2016 um 19:21 schrieb Delgon:
> What if I wanna be sute that I will always add 80 characters?

Just cut it after reading with fread:
T = T(:,1:80);

Btw, this all sounds like a XY-problem:
-- Andy

Help-octave mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]