Problem with imagesc in GUI
2 views (last 30 days)
Show older comments
Hello,
I have a GUI where I import thermal camera data from files and then plot it in the GUI. I have two types of files: xls-data and csv-data. Xls-data is working fine, but when using csv-data, my axes are not set correctly. For example, if the length of the data is 43.2 meters, in GUI the length of x-axis is only 43 meters. And same problem with the y-axis. Any idea how to handle axes properties? The problem is not because of the datatypes (xls,csv, etc.) as I have tried to import data in several ways. However, the problem seems to be related with handling the axes properties of a GUI.
function import_button_Callback(hObject, eventdata, handles)
if handles.datatype == 1
data = dlmread(file, '\t',11,0);
else
data = xlsread(file, -1);
end
length_data = length(data(:,1))*2.5/100; %Pixel-size is 0.025m
width_data = length(data(1,:))*2.5/100; %Pixel-size is 0.025m
data(data<=80)=NaN; %temperature limit set to 80C
clims = [80 160];
gca =handles.image;
handles.image = imagesc(0:length_data, 0:width_data, data',clims);
colorbar;
guidata(hObject, handles);
I was also thinking to set labels manually ('XTickLabel' and 'YTickLabel'), but as I need to draw rectangle (using imrect) in the figure and show/get coordinates, that's not really helping.
0 Comments
Answers (1)
Image Analyst
on 12 Nov 2013
You can use xlim() to set the limits of the x axis to start and stop at whatever values you want rather than have it automatically decide.
See Also
Categories
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!