tags:

views:

36

answers:

1

I run a program, which is a function - here I'll call it 'myfxn' - that outputs several different variables. But when I try to access the data I get

??? Undefined function or variable 'myfxn'.

How do I access the data? Thanks for your help.

+2  A: 

Your question is a bit confusing - you claim you run the function, but then you also say that Matlab throws an error indicating it can't run the function.

Here's two things to test

  1. Is myfxn on the Matlab path? Run the command which myfxn. If that does not find the function, change directory (using cd or the directory browser on the Matlab Desktop) to where myfxn is located.
  2. Does the function actually generate output? If it's a function, the first line should look something like this: function [out1,out2] = myfxn(in1,in2), where in1 and in2 are two input arguments, and out1 and out2 are output arguments. Then, you could call myfxn like this: [a,b] = myfxn(2,'something');, and it will use the two inputs to generate the two outputs, which are assigned to a, and b, respectively.
Jonas

related questions