MATLAB: Doesn’t the read(Tabul​arTextData​Store variable) function return the correct number of rows set by ReadSize property

datastoreread

When using read(TabularTextDataStore) the function returns the correct number of lines determined by the ReadSize property, however occasionally it will return a set of data with less rows and break my script. Why does it not follow the ReadSize property every time I call the read function?

Best Answer

"If ReadSize is a positive integer, then each call to read reads at most ReadSize rows."
There has never been any guarantee that it will read ReadSize rows if they are available. It is permitted to return fewer rows for any internal reason, including potentially switching between files in the datastore, and including potentially reaching a limit of some internal buffer.