read different file formats then return their values

21 Ansichten (letzte 30 Tage)
Yasmin Tamimi
Yasmin Tamimi am 11 Mai 2011
How can I read (.CEP) file format through matlab. I tried fscanf and then disp. fscanf is not working and disp always displays -1 for all my .CEP files!!!
So, what command cann I use to read them?
  8 Kommentare
Yasmin Tamimi
Yasmin Tamimi am 13 Mai 2011
It seems like I was putting the files in the wrong directory, but now when I run the command [fid,message] = fopen('N1RONNO.CEP','r');
fid returns only one number instead of the matrix??
Walter Roberson
Walter Roberson am 13 Mai 2011
fid will only be a file identifier. You will need to textscan() or fscanf() or the like to read the data. See Oleg's example.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 12 Mai 2011
fid = fopen('fullpath/namefile.cep'); % In read mode by default
data = textscan(fid,repmat('%f',1,15),'Delimiter',' ');
fid = fclose(fid);
Substitute 'fullpath/namefile.cep' with your path and the name of the file
  3 Kommentare
Walter Roberson
Walter Roberson am 13 Mai 2011
textscan() returns a cell array.
If you change Oleg's textscan() to
data = textscan(fid,repmat('%f',1,15),'Delimiter',' ','CombineOutput',true);
then afterwards data{1} will be the entire matrix of data.
Yasmin Tamimi
Yasmin Tamimi am 13 Mai 2011
OK. now i got it. Thanx a lot for both of you.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Standard File Formats 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!

Translated by