How to plot a HeatMap in Matlab GUIDE

Do you know how to put HeatMap function into handles of my axis? Everytime I do this the new figure open with my heatmap and nothing is written into handles. Any idea how to fix this , I trie almost everythink like
plot(HeatMap(...),handles.heatMap)
handles.heatMap=plot(HeatMap)
etc.

Answers (1)

Image Analyst
Image Analyst on 19 Aug 2013
What is HeatMap? Is that an image (array variable) in your program? Or is it a vector (1-D array), since you seem to be using plot() imstead of imshow()?
Anyway, it appears that heatMap is the tag (handle) of an axes control on your GUI, so your plot will plot in that axes. But right after that, you overwrite the axes handle with the handle to the line you just plotted. That makes no sense. Both the line/curve you plotted, and the axes itself, will have their own handle ID number. You don't want to blow away the axes's handle with the handle of the thing you just plotted!

9 Comments

HeatMap is the output of the HeatMap function. So what you recommend me? How to put the output of the HeatMap function into axis in GUIDE Matlab. Or do you know different idea how to make this?
You're right. heatMap is the tag of axis in Matlab Guide in which I want to write the plot.
I don't have the HeatMap function. It is not in Base MATLAB or any of the toolboxes I have. What toolbox is it in? List it above in the Products section. What kind of output does HeatMap() produce? An image?
HeatMap is in Bioinformatics toolbox in section Mass Spectrometry. It produce it owns product called HMobject. It's some kind of figure. The problem is how to put an 'image' into axis in GUIDE .
outputImage = HeatMap(....... % whatever...
axes(handles.heatMap);
image(outputImage);
colormap(gray(256));
I went ahead and added the Bioinformatics toolbox above for you.
There's some error :
Conversion to double from HeatMap is not possible.
Error in ==> program>myList_Callback at 127
axes(handles.heatMap);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> program at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)program('myList_Callback',hObject,eventdata,guidata(h Object))
??? Error while evaluating uicontrol Callback
I have done all you wrote above.
What's wrong?
But you're not showing the code. There is some kind of problem, perhaps with the name heatmap which you are using both for an axes tag name, and for the output of the HeatMap() function. Too many heatmaps I'd say. Try using different names.
For your error "Conversion to double from HeatMap is not possible." -- this would not be the error from a call to "axes(handles.heatMap);" if you have an axes called heatMap (it's "tag" property = heatMap). You probably assigned the result from a call to the HeatMap() function to handles.heatMap, thus overwriting your axes handle (if indeed your axes was named heatMap). Remember MATLAB is case sensitive, and you can overwrite things (thus destroying them), and try to make names that are more different. Different in their name, not just their capitalization or whether they're a member of handles or not. For example, call the axes "axesHeatMap", and call the output of the HeatMap function "heatmapResult" or something like that. Don't call everything heatmap with just different capitalizations because it can lead to confusion and typos can lead to errors. It's best to avoid that.
It's problem with heatmap object. It's neither image nor normal plot object. Do you know other way how to create a heatmap so it will be considered as image? Also to have rowlabels, columnlabels,unique colormap and colorbars? And then put it into axis in GUI.
I have no idea because I don't have that toolbox and function, and therefore can't try anything to help you. Apparently no one else here does either since no one else has tried to help you. I suggest you call them. You have a current maintenance contract in force don't you?

Sign in to comment.

Categories

Asked:

on 19 Aug 2013

Community Treasure Hunt

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

Start Hunting!