read different file formats then return their values

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 Comments

What is a .CEP file?
speech signals are preprocessed in order to be time variant and then we get their cepestrum features for the purpose of speaker recognition. I took it in a speech signal course.
Can you open the file in an ordinary text editor? If you could post a sample of the contents of such a file, it would help.
By the way - you never use disp to read a file.
This is one of the files:
0.6046 -1.1121 0.8697 0.0484 0.5776 0.1660 0.4373 0.0596 -0.1055 -0.4145 -0.4982 -0.5456 -0.0587 0.0488 -0.0372 -0.0113
1.1265 -1.8523 1.6355 -0.6776 1.1841 -0.3028 0.9263 0.0151 0.1334 -0.4139 -0.7152 -0.5561 -0.4230 0.1563 -0.0168 -0.0268
2.8052 1.8906 1.5181 0.6186 -0.1594 -0.0030 1.5745 0.5375 2.7317 -0.0106 -2.4461 -0.8841 -0.6953 -0.4639 -0.1602 0.0290
3.1606 0.6620 1.4150 1.5149 -0.4459 -0.1770 0.1093 0.9957 2.1409 1.2171 -2.5895 -1.2282 -0.0600 -0.3069 -0.3337 -0.0231
3.1095 -0.5511 0.5825 1.3594 -0.8476 -0.7348 -1.6093 0.6697 1.1921 1.1641 -1.5523 -0.3897 0.7111 0.3546 -0.1649 -0.0181
3.1360 -1.4917 -0.3274 0.7920 -0.1964 -0.7385 -0.7434 -0.2699 1.0284 1.3203 -1.0234 -0.0764 1.1826 0.5975 -0.0970 -0.0592
3.2161 -1.7158 -1.0363 -0.0386 0.6858 -0.4204 -0.1243 -0.5710 0.7426 1.3000 -0.9149 0.0753 1.2143 0.6743 -0.0505 -0.1007
3.5990 -1.7880 -2.1028 0.4265 0.6460 0.3141 -0.0860 -0.7491 0.1903 1.1077 -0.2986 -0.2256 0.5998 0.6028 0.0437 -0.0802
3.2238 -1.3291 -2.7687 0.3523 1.0752 0.7993 -0.3058 -1.2865 0.7631 0.7855 0.0038 -0.3866 0.0450 0.2287 0.0923 -0.0168
3.8807 -0.9444 -3.0127 -0.9200 2.2334 0.8680 -0.7235 -0.6651 -0.0182 1.2276 0.1582 -0.2840 -0.0561 0.2553 0.2070 -0.0032
3.6989 -0.6222 -2.8517 -1.4032 2.2334 1.5127 -1.1699 -0.7006 0.0829 1.1096 0.4577 -0.2353 -0.1516 0.1657 0.1705 0.0141
3.8743 -0.8388 -2.4171 -1.2966 1.2194 2.0571 -1.0923 -0.5687 -0.4431 1.5936 0.6042 -0.0509 -0.1149 0.1955 0.1889 0.0477
3.8481 -0.4692 -2.7579 -0.6460 0.9407 1.0646 -0.1201 -1.3700 0.3731 1.4830 0.8729 0.1993 -0.0268 0.0953 0.1078 0.0209
3.7172 -0.5783 -2.3985 -0.4475 0.8481 0.3178 0.6681 -1.3136 -0.0005 1.7914 0.9003 0.2490 -0.0325 0.1690 0.0919 0.0130
3.5084 -0.0832 -1.9643 -0.7364 0.5558 1.1842 -0.9567 -0.2730 0.4315 1.3540 0.8800 0.4275 0.0222 0.0236 0.0171 0.0058
3.0508 0.1949 -1.6497 -0.4017 0.7996 0.3477 -0.5174 -0.8306 0.8003 1.5425 1.0224 0.1401 -0.2471 -0.1116 0.0343 0.0205
3.2427 -0.1615 -1.7155 0.3262 0.9463 -0.0611 -0.6711 -0.9358 1.0445 1.7437 1.0710 -0.1297 -0.4095 -0.0950 0.0793 0.0227
-2.0914 -2.0311 1.2775 -1.5745 -1.8137 2.2874 -0.7096 0.7267 -1.2501 -0.8556 -0.1662 0.0690 0.2706 0.2300 -0.1231 0.0172
-2.4611 -2.3072 1.6078 -1.5087 -2.1390 2.2915 -0.6173 0.7979 -0.5064 -1.2213 -0.2948 0.0819 0.3210 0.1283 -0.0684 0.0280
-2.6884 -2.5182 1.8990 -1.4792 -2.1920 2.1677 -0.7010 0.6862 0.1092 -1.4018 -0.2529 0.1055 0.3171 0.0221 -0.0441 0.0376
2.2054 0.6320 1.9975 0.7381 0.2336 -0.6097 0.3948 0.6498 -0.1315 1.0995 0.6896 -0.8726 -0.5098 -0.2051 -0.1914 -0.0786
1.8400 1.1668 2.5364 1.2845 -1.4067 0.0391 0.6172 0.9412 0.5343 -0.1346 1.3759 -0.8563 -0.7591 -0.2156 -0.2020 -0.1316
1.6057 1.9225 3.5247 0.4762 -2.3972 1.2189 0.2013 1.4611 0.5062 -0.1379 1.3907 -1.0650 -0.9132 -0.0619 -0.3434 -0.1633
1.5191 2.3259 3.9458 -0.2063 -2.1516 1.0153 0.6849 0.8597 0.6817 -0.1828 1.2334 -1.3053 -0.6845 -0.0713 -0.4051 -0.1295
1.6981 2.3809 3.7761 -0.3305 -2.0584 1.2632 1.3045 0.0194 1.0999 -0.3013 0.3132 -1.0241 -0.5478 -0.2264 -0.2708 -0.0801
1.5574 2.6088 3.2106 0.1260 -1.7082 0.9379 1.4069 0.6911 0.7247 -0.4027 -0.2343 -0.8930 -0.6588 -0.2820 -0.1364 -0.0498
1.7420 2.7057 2.5351 0.3516 -1.1840 1.0200 0.9090 1.3149 0.1391 0.1060 -0.2611 -0.9096 -0.6228 -0.3539 -0.2346 -0.0636
1.8854 2.6563 2.5847 0.7475 -0.2947 0.3148 1.4294 0.6976 -0.0479 0.8127 -0.8305 -0.6521 -0.5705 -0.4679 -0.2755 -0.0866
1.6014 2.9257 2.2636 0.9191 0.2492 1.2564 0.5916 0.1662 0.6162 -0.2221 -0.4853 -0.6059 -0.5394 -0.4564 -0.2477 -0.0920
1.2413 3.1246 2.4254 1.2328 1.1271 0.4082 0.3689 0.2647 0.1242 0.3917 -0.8906 -0.3734 -0.5610 -0.4419 -0.2596 -0.1051
1.0595 1.8059 2.5571 1.9920 1.7895 0.5369 0.9995 -0.0596 -0.5272 0.7524 -0.6962 -0.8792 -0.4313 -0.4080 -0.2686 -0.1155
0.8415 2.0307 2.6301 1.9244 1.3683 1.2495 0.7277 -0.1876 -0.1618 0.8223 -0.8274 -0.8154 -0.3629 -0.4436 -0.2930 -0.1006
0.5137 1.6520 2.6975 2.1623 1.5446 1.7500 0.9976 -0.4749 -0.2581 0.9521 -0.7801 -0.9156 -0.2799 -0.4276 -0.3076 -0.0916
0.0341 1.4568 2.3460 2.5734 1.5361 1.6705 1.2691 0.5118 -0.8378 0.7175 -0.5022 -0.8252 -0.3203 -0.3416 -0.2893 -0.1058
-1.2532 1.2692 1.3705 1.1664 1.0195 0.6086 -0.4658 -1.0071 1.1362 -1.0406 -0.6703 -0.1504 -0.2569 -0.1459 -0.0550 -0.0320
-1.3821 0.8075 0.5901 0.3176 0.2914 -0.0411 -1.2070 -1.8126 0.9956 -1.5867 -0.9203 -0.1475 -0.1524 -0.0486 0.0373 -0.0024
-0.4747 0.6657 0.4024 0.3981 0.4045 0.4715 0.0136 -0.7074 1.3537 -0.5964 0.0745 0.3459 -0.0572 0.0368 0.0180 0.0028
0.2128 0.3483 0.4669 0.5250 0.6599 0.7508 0.7814 0.8035 0.8885 0.7839 0.7229 0.7989 0.2342 0.1703 0.1040 0.0391
and for the display i first wrote
fid=fopen('N1RONNO.CEP','r')
disp(fid)
and i always got -1 which is wrong and now i knew why, so thnx
Possibly the fopen() is case-sensitive for the file name -- or possibly those should be zeros instead of capital-O.
When fid is -1 that indicates that the fopen() failed. You can use
[fid,message] = fopen('N1RONNO.CEP','r');
and then look at the message to see why the open failed.
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??
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.

Sign in to comment.

 Accepted Answer

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 Comments

Thnx Oleg. I tried ur example but when i wrote data it only gave me the dimensions,, so I really don't know what it really does.
I tried load and it worked.
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.
OK. now i got it. Thanx a lot for both of you.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!