Replace '+-" with '-' in a csv file
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have some data file in .csv format. In the data there are complex values like 3+-3i, but I want to replace all of this '+-' with '-'.
0 Kommentare
Antworten (1)
Chunru
am 28 Jun. 2021
% Read data
fid = fopen('yourfile.csv');
s = fscanf(fid, '%c', [1 inf]); % read all text from file
fclose(fid);
% Replace string
s = strrep(s, '+-', '-');
% Save data
fid = fopen('newfile.csv');
s = fprintf(fid, '%c', s); % read all text from file
fclose(fid);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Import and Export finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!