help-octave
[Top][All Lists]
Advanced

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

Re: : new to octave, confused about load(), dlmread et cetera


From: Justin Cress
Subject: Re: : new to octave, confused about load(), dlmread et cetera
Date: Wed, 1 Sep 2010 09:21:33 -0400

Great code, why do you grab the first two lines? in case headers spill over?

Why do you remove zeros ?

On Wed, Sep 1, 2010 at 12:59 AM, <address@hidden> wrote:
The best solution I have found is to use something like the following(Tested and Working):


close all;clear all;

fid=fopen("file.txt","r");
Row1=fgetl(fid);
Row2=fgetl(fid);
data=""> data([1,2],:)=[]; #Erases first two blank lines
fclose(fid);
clear fid;


Row1=strsplit(Row1,"    ");#Tab character( I use Notepad++ and set to view all characters)
Row2=strsplit(Row2,"    ");

[r,c]=size(data);

This_Data=struct("Field1",Row1,"Field2",Row2,"Data",data);

for i=1:c
This_Data(i).Data="" #Strips all zeros
endfor

disp("Data saved into data structure.")


reply via email to

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