Troubleshooting: Passing String Inputs in Matlab's Structure Field Function

  • Context: MATLAB 
  • Thread starter Thread starter darthxepher
  • Start date Start date
  • Tags Tags
    Field Structure
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
darthxepher
Messages
56
Reaction score
0
For some reason, when I try to use this function it has a problem passing along the fname 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.
 
Physics news on Phys.org
Does no one really know?