how i can create function file for this program

1 次查看(过去 30 天)
when i execute this file i got error
??? Error: File: slic.m Line: 92 Column: 1 Function definitions are not permitted in this context.
what can i do? how can i got correct output? how can i write test file? please help me to write this code?
how i can do this sir please help me sir it was my project's first step i didnt get even the 1st step output now i got function test_slic | Error: Function definitions are not permitted in this context. this error

采纳的回答

Image Analyst
Image Analyst 2014-9-27
I think we talked about this before. You need to either
  1. Put the name of the file following the word function in there, like "function test_slic()" so that you can have both functions in the same test_slic.m file, OR
  2. Put slic() into its own slic.m file and the test routine into its own file called test_slic.m
  5 个评论
Image Analyst
Image Analyst 2014-9-28
Alright, I did it for you. I just followed the explicit directions I gave you in your duplicate post - make them two separate mfiles. They are attached. Now I don't know what any of this does since I didn't dive into it, I just got it running. The files are attached and produce the image below. I really suggest that you look at this link http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab because having two m-files, one that is a function and one to call that function, is a really super basic skill that you will need to learn in order to advance in using MATLAB.
Please mark the Answer as Accepted. Now since you have two posts on the same thing, I'll go over to your other one and paste this answer there too.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by