fopen function how to use a variable name to select a file present in a folder?
Afficher commentaires plus anciens
i have some csv files in a folder which i am trying to edit using matlab.
my code is below
yourfolder='D:\practice\Matlab\APM3 magnet measurements\Sensormagnet1';
d=dir([yourfolder '\*.csv']);
files={d.name};
file=files(1);
fid = fopen(file,'w');
files is a variable which has list of csv files present in folder. i created a variable to get one file name out of the list and trying to open the file with the name present in the file variable.
its giving error as given below:
Error using fopen
First input must be a file name of type char, or a file identifier of type double.
Error in CSV (line 5)
fid = fopen(file,'w');
please help me on this
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Software Development Tools dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!