Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing units of axes and image

Status
Not open for further replies.

suigeneris

Computer
Apr 23, 2003
8
DE
Hi everyone,

all images I have displayed yet have the same size as my matix. For example: I got a matrix 250x1000 then the units of my axes are also from 0 to 250 and from 0 to 1000. But I want to have another unit. I want to see the size of the image in millimeter. How can I manage that?
 
Replies continue below

Recommended for you

Are you using the "image" or "imagesc" command?

If you are, then his should do it.
Code:
data = peaks(100)
x_low = 200;
x_high = 400;
y_low = 50;
y_high = 60;
imagesc([x_low x_high], [y_low y_high], data);

M
 
Hi!

thank you for your reply. But I don't understand your programming code and primarily I don't get the image I want. Maybe I did not explain my problem good enough.

I don't want to change the image itself, I want to change the units of the axes.

Right now the units of the axes are pixel I guess (eg. from 0 to 250 and 0 to 1300) and now I like to have the same image but the tags of the axes should be eg from 0 to 100 mm and from 0 to 50 mm. But the picture should stay the same. I don't want to scale the image itself.

Thank you very much for any reply

sui
 
Well in my somewhat elderly version of Matlab, this is exactly what the above code does. It plots the same image, but the x-axis tick mark labels change (in my example) to 200-400 and the y-axis to 50-60.

For your example:
Code:
data = your_own_image_matrix;
x_low = 0;
x_high = 100;
y_low = 0;
y_high = 50;
imagesc([x_low x_high], [y_low y_high], data);
 
AH! now I understand. But there is another problem. With this code I have to set manually the values. But I want that dynamiclly, so that it knows what x_high and y_high is...

Do I have to calculate that first or can I get the values somewhere?

thanks a lot
sui
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top