help-octave
[Top][All Lists]
Advanced

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

Re: Reading file


From: Delgon
Subject: Re: Reading file
Date: Thu, 22 Dec 2016 10:21:59 -0800 (PST)

What if I wanna be sute that I will always add 80 characters?

Currently I use this one:

   fid = fopen(Filename,'r'); 
    if fid > 0 
      L = ''; 
      while ischar(L), 
        L = fgets(fid); 
        if ischar(L), 
          a = length(L); 
          if a < 80, 
            L = [L ' '*ones(1,80-a)]; 
          elseif a > 80, 
            L = L(1:80); 
          end 
          T = [T; L]; 
        end 
      end 
    end



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Reading-file-tp4681129p4681131.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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