help-octave
[Top][All Lists]
Advanced

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

Re: just for the sake of curiosity ...


From: Dmitri A. Sergatskov
Subject: Re: just for the sake of curiosity ...
Date: Sat, 18 Jun 2016 05:36:10 -0500

On Sat, Jun 18, 2016 at 5:22 AM, Dr.-Ing. Dieter Jurzitza <address@hidden> wrote:
Dear listmembers,
after solving my issues with fprintf() by your help in a very elegant manner
(Thanks again!) I was thinking about a similar way for fscanf().

I had had asked about something like

X,Y=fscanf (infile, "%f %f");

given that "infile" points to a file with two consecutive columns of say
double values. I was recommended to use "textread" instead what actually
solved my problem.

However, given that

fprintf(oufile, "%f %f\n", (X;Y));

would actually solve the "write" side of writing two vectors to a file, I
thought of a similar attempt to solve this for fscanf, say

[(X;Y)]=fscanf (infile, "%f %f");


​Try
z = fscanf(infile, "%f %f");
x=z(:,1), y = z(:,2);​

​Dmitri.
--


reply via email to

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