Having problems with functions

I've built a function, which I'm giving three values x, y and a. however when I run it I get the following error:
??? Reference to a cleared variable a.
Error in ==> parallel_inverse at 68
a = a * pi/180;
This is my function start:
function parallel_inverse(x, y, a)
Does anyone know why I'm getting this error?

4 件のコメント

Walter Roberson
Walter Roberson 2012 年 12 月 11 日
We need to see the code for your routine.
Ian Phillips
Ian Phillips 2012 年 12 月 11 日
As in where I call it? Or the code for the whole function? It's just:
>> parallel_inverse(0,0,10);
where I call it. I don't really want to display the whole function as it's coursework and I don't want it plagirised.
Matt J
Matt J 2012 年 12 月 11 日
編集済み: Matt J 2012 年 12 月 11 日
Well, the error message is saying that you cleared the variable "a" somewhere prior to where you try to use it in the line
a = a* pi/180
If you don't want to show your code, then you'll have to go hunting for the clear statement yourself.
Ian Phillips
Ian Phillips 2012 年 12 月 11 日
Thanks. I found the problem. first two lines in the function are:
clear;
clc;

回答 (0 件)

この質問は閉じられています。

質問済み:

2012 年 12 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by