Problem with imagesc in GUI
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Image Analyst
2013-11-12
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!