From: Walter Roberson on
Dmitry wrote:
> Walter Roberson <roberson(a)hushmail.com> wrote in message
> <hss7ql$59c$1(a)canopus.cc.umanitoba.ca>...
>> Dmitry wrote:
>> > I'm trying to take a variably sized data file with a variable sized
>> > header and turn it into two workable pieces of data, a textdata and
>> a > normal data, and I can't use the importdata or UIimportdata commands.
>> > > My solution so far has been to parse the data file looking for the
>> end > of header mark, '*END*', and then separate the header and the
>> data into > two different cells (header and data). The only problem
>> is that now I > have to separate my data, with an X amount of columns,
>> into their own > column in the data table.
>>
>> If you read the text into a single string, newlines and all, then
>> str2num() will convert it into an array of the correct size. You can
>> use fread() with '*char' as the precision to read the rest of the file
>> into a string.
>
> Bump as I'm still unable to make this work. I feel like this is on the
> right track though. However, when I run the fread() with *char, it
> still spits out the entire file instead of separating it.

Right -- and you use str2num() on that string:

str2num(fread(fid,'*char'))