help-octave
[Top][All Lists]
Advanced

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

Re: how to save a text file


From: Andreas Weber
Subject: Re: how to save a text file
Date: Tue, 6 Mar 2018 10:24:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Am 05.03.2018 um 23:42 schrieb Kasius Klej:
> I'm trying to modify a text file and having trouble with what seems to be an
> easy task. I'm new to Octave and the documentation for me is all Greek for
> now. Perhaps someone could help me? I gather this is an easy question.
> 
> #this works fine for me
> [A]=textread('input.csv', '%s');
> A= strrep(A,",",";");

This sounds like an XY-Problem. What do you really want to do?

If you want to replace "," with ";" in a file you would use tr or sed on
unix like systems. If you want to do this in GNU Octave I would do:

A = fileread ("input.csv");
A = strrep(A, ",", ";");
fid = fopen ("out.csv", "w");
fputs (fid, A);
fclose (fid);


But keep in mind that you can change the delimiter in dlmread (just in
case your actual question is how to read a CSV)

-- Andy



reply via email to

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