フィルターのクリア

Function not defined error

3 ビュー (過去 30 日間)
kajalschopra
kajalschopra 2015 年 8 月 3 日
コメント済み: Walter Roberson 2015 年 8 月 4 日
Hi,
I have the following code snippet;
function [mass]=ElementMassMatrix1Bar(rho_E,A_E,E_C,N_C,element_no,p,n_dof)
J=Jacobian(element_no,E_C,N_C);
The function Jacobian is defined in another .m file.
I had thought I should be able call it.
But I get an error that,
function JAcobian not defined.
I am finding it funny because the function JAcobian is called inside another function (say 'X') but X being located in the same .m file as JAcobian.
But when I call JAcobian from a function located in another .m file, it says function not defined error,
Please can anyone help..
Thanks a lot.

採用された回答

Walter Roberson
Walter Roberson 2015 年 8 月 3 日
Be careful with JAcobian vs Jacobian -- MATLAB considers the two to be different names.
In order to call a function in another file, the file must be named the same thing as the function and the function must be the first thing in the file. The exception to this is if the first function in the file creates a handle to the desired function and puts the handle in a useful place (such as returning it.)
  4 件のコメント
kajalschopra
kajalschopra 2015 年 8 月 4 日
編集済み: kajalschopra 2015 年 8 月 4 日
Thank you. And, last one, I have a set of programs in D:\directoryX and another set of programs in D:\directoryY
I have ElementJacobian .m file (and the first function in the ElementJacobian.m file named as ElementJacobian) in D:\directoryX
I want to call ElementJacobian from D:\directoryY
Is it possible? How? Thanks again, Kajal
Walter Roberson
Walter Roberson 2015 年 8 月 4 日
See addpath() and pathtool()

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by