Index in position 1 exceeds array bounds (must not exceed 1). please do help to fix this error.
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
for y=0:0.1:1
if y(i,j)<=0.5
p(i,j)=2*(y(i,j)^2);
else
p(i,j)=1-2*((1-y(i,j))^2);
end
end
end
end
figure, imshow(p)
3 Kommentare
Star Strider
am 11 Apr. 2020
You define ‘y’ aas a scalar (it will be a scalar in every iteration of the loop), and then address it as a matrix in the following line:
for y=0:0.1:1
if y(i,j)<=0.5
I suspect that is what is throwing the error.
The solution is to address it correctly.
If you already have a matrix called ‘y’, using ‘y’ as the loop index variable will overwrite it.
darova
am 11 Apr. 2020

Antworten (1)
uma
am 12 Apr. 2020
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!