scatterhist X & Y length error

1 view (last 30 days)
Dan
Dan on 14 Oct 2014
Commented: Star Strider on 14 Oct 2014
Hi Guys!
I've been using a GUIDE GUI to display data on a set of axes. The user has the option to use a bar graph, scatter plot, or scatterhist. The problem shows up with the scatterhist function. The code I'm using is as follows:
scatterhist(handles.PDBPlot,DataXPlot2,DataYPlot2);
Which generates the following error:
Error using scatterhist (line 120)
X and Y must be numeric vectors with the same length.
I've check it, and DataXPlot2 and DataYPlot2 are the same length, and when I bring those arrays into the Workspace, the scatterhist command works fine, so something about my handles.PDBPlot (tag of my axes) is tripping it up. I'm a little stuck on this one, and some help from you guys would be really great!
Thanks,
Dan

Answers (1)

Star Strider
Star Strider on 14 Oct 2014
The scatterhist function seems to want its first two arguments to be the x and y arrays.
I don’t know what you’re doing here with the first argument:
scatterhist(handles.PDBPlot,DataXPlot2,DataYPlot2);
  2 Comments
Dan
Dan on 14 Oct 2014
Thanks for your answer. The way I understand that it should work is that the first argument should define the set of axes that I'm trying to plot to, and the next two arguments are the inputs. The odd part is that the following line of code works just fine for a standard scatter plot.
scatter(handles.PDBPlot,DataXPlot2,DataYPlot2);
Star Strider
Star Strider on 14 Oct 2014
The scatter function offers that option in its allowed input arguments, but scatterhist does not, at least that I can determine.

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps 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!