hi i stuck in basics of matlab function command

clear all
clc
function [z,t]=calc(x,y)
z=x-y;
z=x+y;
i saved this file naming it calc.m but when i am giving input from main window the following error occurs
calc(2,3) % input ??? Error: File: calc.m Line: 3 Column: 1 Function definitions are not permitted in this context.

 Accepted Answer

Delete the "clear all" and "clc"

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!