how to plot two-column text file of the energy spectra

2 visualizzazioni (ultimi 30 giorni)
Dear all,
as attached is a two-column text file of the energy spectra. anyone can help me to plot it?
  4 Commenti
Star Strider
Star Strider il 27 Mag 2023
At least one is a binary file. What is the format? What are we supposed to do with it?
Uzip1 = unzip('point1.zip')
Uzip1 = 1×1 cell array
{'point1.bis'}
Uzip2 = unzip('point.zip')
Uzip2 = 1×6 cell array
{'point/point1.bim'} {'point/point1.bis'} {'point/point1.him'} {'point/point1.int'} {'point/point1.prn'} {'point/point1.res'}
Uzip3 = unzip('point1 (2).zip')
Uzip3 = 1×1 cell array
{'point1.bim'}
type(Uzip1{1})
ûm3=bÂ5=ùù1=µu!=1C□=¤D□=åcÿ<A□í<®¨Ù<□ðË<E÷À<õ$¾<¾«¼<□´¾<åÛµ<žº<ÈÄ­<Ä?°<□δ<¨¯²<□□¼<□C½<YDº<Ò□¯<gäº<□ĸ<Ñ°¿<a Ä<□□Ø<è¬Ù<î□ç<□«ô<i~ý<□Ô□=□÷□=8í□=ÕÊ□=c\!=³Ç$=$Í(=t,.=□□&=□m+=à□&=.I*=ÿ□□=>%□=ä`□=□Ôæ<èôÒ<æöÒ<□TÛ<:Îí<¥□□=L8@=."|=Xâ□=ÉMÑ=èA□>ÿ□□>éÖ?>Aci> □□>□□£>¥□¼>ÕÒÔ>TÆð>□ú□?Ë%□?÷M ?□¸,?an7?Ñ□A?*ÉJ?%□Q?IÕY?­ñ`?¬ôd?_`l?òUt?±□y?öU□?áÈ□?□ë□?□t□?³À□?À□□?çõ□?□□□?ø>¡?þ□¤?□¿¨?□"©?4□©?□0ª?"□ª?ñü©? Û§?A□¦?F4¥?Îî¤?□□¢?□Þ ?åÌ ?□□ ?ûÁ□?~þ□?@□□?h□□?□□□?QÛ□?f□¡?\|¡?□□¢?Do¢?üÛ¢?±ÿ¤?¼ý¤?ZÙ¦?@G©?Ó7ª?ß ­?|y¯?Çͱ?GÖµ?ÙX¼?<□Á?@□Ë?½Ê×?ã□ç?Ë□õ?□Ñ□@□}□@□T□@ùÕ @ón(@ö{-@M71@□Î/@¢þ+@□Ø$@¹ö□@ù □@_□ù?9À×?8¿µ?Ðc□?-óo?Õ¡:?KÆ ?nvÑ>□Á□>%fO>Ã* >Úл=.:u=7c□=íÜ·<â [<rb□<y*□;*□□;)ê□:;¡?:□ù□9|±U9□xc8Øã*8□□□□¬R□7□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
fidi1 = fopen(Uzip1{1})
fidi1 = 3
A = fread(fidi1, [128 2], 'double')
A = 128×2
1.0e+00 * 0.0000 0 0.0000 0 0.0000 0 0.0000 0 0.0000 0 0.0000 0 0.0000 0 0.0000 0 0.0000 0 0.0000 0
figure
plot(A(:,1), A(:,2), '.-')
.
mohd akmal masud
mohd akmal masud il 28 Mag 2023
Actually this is the instruction:
The output from the program is now in the files point1.res, point1.bis, and point1.bim. Print out point1.res and identify the different results from the description in the on-line manual. To get a readable version of the spectra, perform the command
bis point1
which now produces a new file point1.prn. This is a two-column text file of the energy spectra which can be imported to Excel or plotted using, e.g. the freeware gnuplot program. The file point1.bim is a floating point 64×64 matrix that can be briefly viewed by the command
bim point1
To convert to an integer image for display using, e.g. the ImageJ program, give the command bim point1/oi/nm:1000
A new point1 file with the extension *.int is now created and the maximum pixel value is normalized to 1000. You can now display this image in a display program
So all the file I was generate as attached here

Accedi per commentare.

Risposta accettata

dpb
dpb il 28 Mag 2023
Modificato: dpb il 29 Mag 2023
uzip = unzip('point.zip')
uzip = 1×6 cell array
{'point/point1.bim'} {'point/point1.bis'} {'point/point1.him'} {'point/point1.int'} {'point/point1.prn'} {'point/point1.res'}
spec=readmatrix('point/point1.prn','filetype','text');
whos spec
Name Size Bytes Class Attributes spec 17x2 272 double
figure
plot(spec, 'x-')
Doesn't look too interesting, what's the data itself look like????
spec
spec = 17×2
NaN NaN NaN 1 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 32
Almost everything in what supposed to be a text file of numbers wasn't able to be read as numbers...what's the content of the file itself....?
type point/point1.prn
===================================================== File Name..............: point1.bim Image number...........: 1 Matrix smoothed........: NO Maximum in matrix......: Infinity Total in the matrix....: NaN Total in the line......: NaN FWHM calculated to.....: 0.000000E+00 pixels FWHM calculated to.....: 0.000000E+00 cm Pixel Size.............: 0.100000E+01 cm Line Number............: 32 No of added lines......: 1 Vertical direction.....: NO Normalization..........: NO Matrix algebra.........: NO No of added matrices ..: 0 Maximum found (col,row): 0 ,0 =====================================================
Well, that's a text file, indeed, but whatever you did before zipping up the results did NOT result in the results described as "which now produces a new file point1.prn. This is a two-column text file of the energy spectra...".
You'll need to go through the steps as described; eventually somehow you'll manage to get a text file that does actually contain the data itself I presume, but it's simply too inconvenient of a form here to keep poking at when don't have a klew what all the stuff referred to is or where it came from or...
As the above shows, when you get to that desired .prn file, it will take almost nothing to read and plot it, but getting to that point is NOT a MATLAB problem; that's all tied up in whatever system it is that produced the data files and its toolset.
ADDENDUM:
Maybe the data follow the header??? This platform limits the amount of output shown so have to work around that to see anything -- that's why it so inconvenient to not have the text file itself attached...anyways, let's try
spec=readlines('point/point1.prn'); % read as text
whos spec
Name Size Bytes Class Attributes spec 19x1 2374 string
spec(19)
ans = ""
Well, that's not it, either -- readmatrix did the best it could; all that file contains is the descriptive data and the empty last record...
  1 Commento
mohd akmal masud
mohd akmal masud il 30 Giu 2023
The raw file as attached is .prn (as attached)
Then I import data in excel (as attached)
Then I plot the graph using excel (as attached)
So now,i want to plot it using Matlab.
Can help me?

Accedi per commentare.

Più risposte (1)

dpb
dpb il 30 Giu 2023
data=readmatrix('point1.prn.xlsx');
whos data
Name Size Bytes Class Attributes data 512x2 8192 double
plot(data(:,1),data(:,2))
Seems easy enough...

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by