MATLAB Answers

Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

13 views (last 30 days)
Agus Kafiar
Agus Kafiar on 16 Apr 2021 at 13:52
Edited: Bruno Luong on 16 Apr 2021 at 14:18
>> data=imread('C:\Users\ASUS\OneDrive - Universitas Atma Jaya Yogyakarta\Pictures\Jeruk1.jpeg');
>> R=data(:,:,1);
>> G=data(:,:,2);
>> B=data(:,:,3);
>> gray=0.3333*R+0.3333*G+0.3333*B;
>> [m,n]=size(gray);
>> for i=1:256,
H(i)=0;
end,
>> for k=1:m,
for 1=1:n,
for 1=1:n,
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax
error. To construct matrices, use brackets instead of parentheses.
  1 Comment
Agus Kafiar
Agus Kafiar on 16 Apr 2021 at 13:56
I Have this code that has been given but when I tried to apply it showed an error can someone help me please

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 16 Apr 2021 at 14:11
for 1=1:n,
The number 1 is not a valid variable name in MATLAB and so cannot be used as the loop variable in a for loop.

Bruno Luong
Bruno Luong on 16 Apr 2021 at 14:14
Edited: Bruno Luong on 16 Apr 2021 at 14:18
The for loop varable is lowercase L char "l" (l), not one "1" (1)
for l=1:n

Community Treasure Hunt

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

Start Hunting!