how i can create function file for this program

1 view (last 30 days)
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

Accepted Answer

Image Analyst
Image Analyst on 27 Sep 2014
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 Comments
Image Analyst
Image Analyst on 28 Sep 2014
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!