Construct image from given file

these are the codes of my script to open the attached file
f= fopen('d20160413.txt');
c = textscan(f,'%s','delimiter','\n');
fclose(f)
c = c{:};
[~,~,~,v] = regexp(c,'\d*\.\d+E[\-\+]\d{2}')
out = reshape(str2double([v{:}]),27,[]);
however, i cannot construct the image from the code. I have used imshow(out) to get the image but it doesnt work.

5 Comments

Nada - what should the image be? Given your code and the attached text file, the image data seems to be taken from the second column for each scan (of which there are 27). These values are small - with the minimum of out being 0.0676 and the maximum being 1.9912. Is this what you expect? Do you need to provide a map to assign colours to ranges of numbers?
Nada Zamri
Nada Zamri on 13 Oct 2016
Edited: Nada Zamri on 13 Oct 2016
Hi, the image should be in the form of dose maps. Actually for my assignment, I need to construct the 27x27 matrix from the original data (attached file), so I managed already to get the data in 27x27 matrix. But now, I am having problem to construct the dose maps, I already tried, but the image seems quite small compared to the image obtained in Verisoft software.
So you read your data in and made a 27x27 image/matrix. But you say that's too small. Exactly how big do you think your "original data" should be, and if it's not 27x27, then how and why did you create a 27x27 matrix from it?
Nada Zamri
Nada Zamri on 13 Oct 2016
Edited: Nada Zamri on 13 Oct 2016
The original file is in the mcc format which can be opened using notepad,but all the data were scattered, so I arranged it and put all the numerical data in the form of matrix. and yes it works, thanks to Mathworks for providing the code. But to get the image,I tried to used imshow(out), however, the image obtained is quite small,I have also opened the original file which is in mcc format using software verisoft and the image is bigger than what I have obtained using matlab and it also in color maps not in grayscale.
I used 27x27, because I counted it manually and all the numerical data fits to be put in the matrix of 27x27.
27 x 27 is all that is in that file. You can imshow() it with an InitialMagnification to show in a larger window, but there just isn't more data there.

Answers (0)

This question is closed.

Tags

Asked:

on 13 Oct 2016

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!