Results 1 to 3 of 3

Math Help - Passing field name into function

  1. #1
    Newbie
    Joined
    Jun 2010
    Posts
    9

    Passing field name into function

    For some reason, when I try to use this function it has a problem passing along the field name input.
    For example, I'd type something like :

    Field(S, 'names')

    ------------------------------

    This returns an error:

    ??? Reference to non-existent field 'fname'.

    Error in ==> CheckFieldConsistency at 4
    [m n] = size(Q(1).fname);

    ---------------------------------


    function output = Field(Q, fname)

    k = 0;
    [m n] = size(Q(1).fname);
    dim = [m n];


    Can someone please enlighten me on how I would go about passing this string along into the function to be utilized?

    Thank you for your time.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Jun 2010
    Posts
    9
    And btw i am using MATLAB.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Mar 2007
    Posts
    206
    Awards
    1
    Try "getfield"

    Field of structure array - MATLAB


    Regards Elbarto
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Find the potential function f for the field F
    Posted in the Calculus Forum
    Replies: 2
    Last Post: December 6th 2010, 05:34 AM
  2. Function field of a covering
    Posted in the Advanced Algebra Forum
    Replies: 0
    Last Post: June 30th 2010, 02:54 PM
  3. Replies: 2
    Last Post: February 12th 2010, 05:41 AM
  4. Potential Function of a Vector Field
    Posted in the Calculus Forum
    Replies: 2
    Last Post: November 13th 2009, 10:05 PM
  5. Replies: 1
    Last Post: November 15th 2008, 06:55 AM

Search Tags


/mathhelpforum @mathhelpforum