how to read an .asc file into a matlab matrix
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Youngchan Kim
le 3 Mai 2016
Modifié(e) : Walter Roberson
le 3 Mai 2016
Dear users
I have a trouble to read a asc file to a matlab array. Below is an example of its format. The length of each array was reduced for the sake of simplicity. I want to read the numbers into matlab array or matrix. So I tried to use a ‘textread’ to read this file to a matlab array but the output is not that I want.
out = textread('fcs.asc','%s', 'delimiter', '\n');
I suppose there might be an easy way to get this. So can you please share your knowledge with me?
best wishes,
Youngchan
Title : xxxxx
Version : 2 970 M
Revision : 12 bits ADC
Date : 2016-04-15
Time : 17:41:57
Author : Unknown
Company : Unknown
Contents :
*BLOCK 1_1 Decay
0
115
121
122
115
115
121
122
115
121
122
0
*END
*BLOCK 1_1 Fcs
Measurement time [s] : 150.4176177979
Mean countrate [kHz] : 35.6787328411
( Time[µs] FCS_value )
0.000000 0.0000000000
0.012500 0.0000000000
777232.462500 1.0000174174
837019.575000 1.0001186095
896806.687500 1.0000666853
956593.800000 1.0000106421
*END
*BLOCK 1_1-2_1 Fcs
Measurement time [s] : 150.4176177979
Mean countrate [kHz] : 33.4725085646
( Time[µs] FCS_value )
0.000000 0.0000000000
0.012500 0.0000000000
777232.462500 1.0000174174
837019.575000 1.0001186095
896806.687500 1.0000666853
956593.800000 1.0000106421
*END
*BLOCK 2_1 Decay
0
115
121
122
115
115
121
122
115
121
122
0
*END
*BLOCK 2_1 Fcs
Measurement time [s] : 150.4175567627
Mean countrate [kHz] : 31.2663302158
( Time[µs] FCS_value )
0.000000 0.0000000000
0.012500 0.0000000000
777232.462500 1.0000174174
837019.575000 1.0001186095
896806.687500 1.0000666853
956593.800000 1.0000106421
*END
0 commentaires
Réponse acceptée
Image Analyst
le 3 Mai 2016
I never heard of that format. It's it's some custom complicated format then you're going to have to read it in line by line with fgetl() and parse it out yourself.
3 commentaires
Image Analyst
le 3 Mai 2016
That just reads the whole file into a string. You'll still have to parse it out according to your custom format. Because of this I think it's simpler to do it like I said - a line at a time - rather than how you suggested.
Sorry, but it there is no reader for it that you can find, you'll have to write it yourself. What program generated this file? Perhaps you can ask the publisher if there is a MATLAB reader for it.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!