hi i stuck in basics of matlab function command

6 views (last 30 days)
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

Walter Roberson
Walter Roberson on 25 Dec 2012
Delete the "clear all" and "clc"

More Answers (0)

Categories

Find more on Entering Commands 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!