How to plot values in a grid manner so as to form an image?
Mostrar comentarios más antiguos
I am writing a function which read data from a file having the following dimension [105 1 107]. Now I want to plot the data(which is in the form of a single column] in a manner such that it creates an image with dimensions [105 X 107]. I have written the following function, but all I get is a blue image, whereas I should get an image with different colors based on the values present at x,y co-ordinate in the mzSpecificData. Can anyone please let me know what is going wrong?
[x,temp,y]=size(mzSpecificData)
for yLoop = 1:y
for xLoop = 1:x
image(mzSpecificData(xLoop,temp,yLoop))
end
end
here; max value of x = 105, value of temp = 1 (which is a single constant value) max value of y = 107
2 comentarios
Image Analyst
el 1 de Mayo de 2013
What does this mean: "plot the data(which is in the form of a single column] in a manner such that it creates an image with dimensions [105 X 107]" Do you want to plot the values of one of the 107 columns as a line chart, or do you want to take that y-z plane of your image and display it as a 2D gray scale image? What you said is ambiguous. What do you want to do: plot or display?
Novice Geek
el 6 de Mayo de 2013
Respuesta aceptada
Más respuestas (1)
Anand
el 1 de Mayo de 2013
Try this:
im = squeeze(mzSpecificData);
image(im); %or imshow(im);
4 comentarios
Novice Geek
el 6 de Mayo de 2013
Image Analyst
el 6 de Mayo de 2013
I don't think you'd have a loop. Certainly not the one you had were you were displaying just a single pixel!
Novice Geek
el 6 de Mayo de 2013
Novice Geek
el 6 de Mayo de 2013
Categorías
Más información sobre Images en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!