1

I have a function_1 that returns value and from function_2, I want to get the value of function_1 to use it I tried :

function ret = getValue(arg)

            ret = find(arg,'toto');

   end

function selectValue(arg,val)
            f = @getValue(arg);
            switch val
                case 'tata'
                    f.select(1)
                case 'titi'
                   f.select(0);
            end
end

but I got error when trying to do f.select(1) in general, if I want to use the value of returned function in another one how do could I proceed ? could someone help ?

thanks,

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
lola
  • 5,649
  • 11
  • 49
  • 61

1 Answers1

1

You are getting an error because f=@getValue(arg) returns the handle to the function, not a handle to the return value. What you should do is return the handle of the object that you want to act upon, and then use that handle (which is just number) in f. Unfortunately you cannot achieve this in a straightforward manner, but you should use a wrapper class and hgetset. Check this out : Can properties of an object handle returned from a function be used without first assigning to a temporary variable?

Community
  • 1
  • 1
  • the comment is as vague as the code. Please edit above and provide precise code, to get a precise answer. –  Mar 13 '12 at 13:52