how to call prepared function (m file)
显示 更早的评论
Hi,
I downloaded a function a function and I want to use it in my script. I tried to call it by using 'load' and 'import' but got error.
how can I call it?
采纳的回答
Hi Sani,
You can directly call the function with its name, provided it is in the path. For example your downloaded function name is myfun.m, then directly call with its name and required inputs in the script you want to access.
Regards,
Sriram
8 个评论
It says Undefined variable when I do that
Is that ensured the file is in the matlab path? Does the function have any inputs and outputs? Can you show what the error is?
I downloaded the function from here: https://www.mathworks.com/help/matlab/ref/scatter.html
the error messege is:
scatter_kde.m
Undefined variable "scatter_kde" or class "scatter_kde.m".
Hi Sani, i didn't see any function with name scatter_kde.m, in that page.
sorry wrong URL, this it the one: https://www.mathworks.com/matlabcentral/fileexchange/65728-scatter-plot-colored-by-kernel-density-estimate
Thanks for the link. May i know if the example provided in the function, works? Like, try help scatter_kde in command promt and run the example.
yes it works
Then, it should work if used in script directly. Use it with scatter_kde(x,y) in the script
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Downloads 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
