Matlab table function

1.2k views Asked by At

I have tried running the example as shown in the documentation of MuPAD table:

T := table(a = 13, c = 47)

Doing so gives me the following error:

Undefined function 'T' for input arguments of type 'char'.

I have no idea what is going on. Does anybody know why it isn't working and how I can create a table using this function?

2

There are 2 answers

1
Bruce Dean On BEST ANSWER

If you look at the top of the page, you are reading about functions contained in the "Symbolic Math Toolbox." I believe you need to pay for that license to use functions from the toolbox.

From Matlab's help for that error you either:

  • Made a typographical error ...
  • Changed directories so that a function is no longer on the search path...
  • Used the wrong case for a function or variable name ...
  • Are trying to use a function for which you are not licensed.

I got the same error as you, and I also do not have that Toolbox, so perhaps its the last reason.

Is it time to switch to Python?

0
nkjt On

This happens when you try to call a muPAD function from the MATLAB command line. Whenever you see :=, that's a clue that you're dealing with muPAD. You cannot use muPAD syntax directly in MATLAB (feval or evalin and symengine can be used in some cases to call muPAD functions and return a symbolic expression).

To use table in muPAD:

Call mupad at the command line to open up a muPAD notebook, then call your sample line. You do not need the latest MATLAB version, although I'm not sure exactly when it was brought in (works fine for me on 2011b with Symbolic toolbox).

To use table in MATLAB:

The muPAD table function should not be confused with the MATLAB table function/datatype, which is relatively new. The equivalent in MATLAB of that muPAD code would be something along the lines of (untested):

T = table([13;47],'RowNames',{'a';'c'});