1 Replies - 833 Views - Last Post: 31 July 2012 - 12:23 AM Rate Topic: -----

#1 Den Onde  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 22
  • Joined: 09-February 10

MATLAB: Get handle that is stored in a vector

Posted 30 July 2012 - 10:49 PM

Hello!
I'm struggling with an issue that is part of an assignment.
What i'm trying to do is store different plot-handles and store them in a vector.
Then i should be able to retrieve that handle and change the attributes of the different plots (widht, color, etc).

I've tried this:


% createPlot.m
& taken handle of a vector as in parameter

function out = createPlot(plot_Handles)

x = linspace(0,3*pi,50);

whichGraph = input('Give graph id: ');
disp(['Graph: ', num2str(whichGraph)]);

theFunction = input('Give function: ', 's');
y = eval(theFunction);
disp(['Function: ', theFunction]);

h = plot(x, y);
%get(h); This works just fine to get the properties
plot(x, y);

plot_Handles(whichGraf) = h; % store the handle in the vector

get(plot_Handles(whichGraf)); % THIS DOES NOT WORK?? WHY??

out = plot_Handles;





As you can see, the problem is when i try to retrieve the handle from the vector.
I can't figure out what i do wrong :S

Appreciate any help i can get.

Best Regards
Den0nde

Is This A Good Question/Topic? 0
  • +

Replies To: MATLAB: Get handle that is stored in a vector

#2 Den Onde  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 22
  • Joined: 09-February 10

Re: MATLAB: Get handle that is stored in a vector

Posted 31 July 2012 - 12:23 AM

Sorry, forgot to mention that it is MATLAB im using... Slipt my mind...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1