Pallavi
Pallavi

Reputation: 1

Matlab error in function calling

I have written a function in matlab but it is showing error. Please help me out.

this is my main calling file.

for j= 1:10
   for i= 1:81
     MAG1(i,j)=20*log10(MAG(i,j));
     satplotm(j,MAG1(i,j),PHA(i,j)); %error
     hold on
  end

and this is my function

function satplotm(j,m(k,j),theta1);

the lines which i have written in bold letters are showing error and this is the error,

Error: File: satplotm.m Line: 1 Column: 22 Unbalanced or unexpected parenthesis or bracket.

Error in Templates (line 471) satplotm(j,MAG1(i,j),PHA(i,j));

please help.

Thanks in advance.

Upvotes: 0

Views: 62

Answers (1)

Ander Biguri
Ander Biguri

Reputation: 35525

If you read your error message (protip: read error messages), you have an extra/missing parenthesis or brakect on line 1.

That is because defining a function input as an index of a matrix make no sense.

Define your fucntion as function satplotm(j,m,theta1);

and then set m to be a single thing, as you already do in the for loop.

Upvotes: 1

Related Questions