Multiple functions working together?

조회 수: 2(최근 30일)
Michael Vaughan
Michael Vaughan 2020년 9월 24일
댓글: Michael Vaughan 2020년 9월 24일
here is my code in a script coding window:
function [n] = n(x)
syms q
function d=d(x)
I then save this and go to the command window and type in d(3), which I would like the output to be equal to n(4), but instead I get this:
Index exceeds the number of array elements (1).
Error in sym/subsref (line 870)
R_tilde = builtin('subsref',L_tilde,Idx);
What the heck is going on!!? I'm new to this, help appreciated!

채택된 답변

Star Strider
Star Strider 2020년 9월 24일
MATLAB is interpreting:
as indexing into the third element of ‘d’.
which d -all
from a script or your Command Window to see if MATLAB can locate the ‘d’ function in the search path (preferably on your user path).

추가 답변(1개)

David Hill
David Hill 2020년 9월 24일
syms q
  댓글 수: 1
Michael Vaughan
Michael Vaughan 2020년 9월 24일
what does the (x) do after the @ symbol???? Is it necessary? I seem to be giving functions handles without including that and it works fine

댓글을 달려면 로그인하십시오.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by