Vectorise or make this code run faster

How would I make this code run faster:
for i=1:nRows
for j=1:nCols
Z=I(i,j,1)-I(i,j,2)-I(i,j,3);
end
end
Thank you

Antworten (1)

Guillaume
Guillaume am 17 Nov. 2018

0 Stimmen

This is really basic matlab
Z = I(:, :, 1) - I(:, :, 2) - I(:, :, 3);

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2017b

Gefragt:

am 17 Nov. 2018

Beantwortet:

am 17 Nov. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by