Error: ()-indexing must appear last in an index expression

1 view (last 30 days)
I m getting this error while i try to execute this code
for i=1:n
for j=1:n
b1=bu(1,i)(j);
a1=(n*b1/(m(i)*m(j)));
p{1,i}=a1;
end
end
here bu is a cell of size(1,n)
m is an array of size(1,n)
p is i a cell of size(1,n)
please help
Thanks in advance!

Accepted Answer

Wayne King
Wayne King on 10 Jan 2013
I'm guessing you want:
for i=1:n
for j=1:n
b1=bu{i}(j);
a1=(n*b1/(m(i)*m(j)));
p{i}=a1;
end
end
  4 Comments
Walter Roberson
Walter Roberson on 15 Jan 2013
No, your code was
b1=bu(1,i)(j);
with round brackets after bu, not curly brackets. () compared to {}

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!