MATLAB: Error – “() Indexing must appear last in an index expression”; what is wrong with the code? I’m new to Matlab. error N(i)=(-1)^s*(F(f,1)(1/2)+F(f,2)(1/4)+F(f,3)(1/8))*2^(c-2) Best Answer F(f,1)(1/2) means that you want to index F at locations f and 1, and then you want to index that result at index 1/2 .Perhaps you intended to write in some multiplication? MATLAB has no implicit multiplication. Related SolutionsMATLAB: Error in Matlab – “() Indexing must appear last in an index expression” size(A,1)(instead of size(A)(1)) MATLAB: Indexing error: ()-indexing must appear last in an index expression In MATLAB you cannot index into an array that you've already indexed into, so you cannot do thisout{i} = out2(:,:,j)(Cs{i}, beta{i}, As{i}, TCI{i}, TWI{i}, hs{i})But assuming the rest of your code is OK (which I could not check), then you could define a temp variable out2_tmp = out2(:,:,j); out{i} = out2_tmp(Cs{i}, beta{i}, As{i}, TCI{i}, TWI{i}, hs{i}) Related QuestionError message ()-indexing must appear last in an index()-indexing must appear last in an index expression()-indexing must appear last in an index expression
Best Answer