Filling a array/matrix without for-loop

array = zeros(1, 20);
for i = 1:20
array(1,i) = %some formula dependent upon i, e.g. (i-1)*value1*value2/value3
end
Desired: A way to do it without the for-loop. I know it's probably out there yet but I didn't find it via the google or searching the forum. Sorry for possible duplicate.

Antworten (1)

BhaTTa
BhaTTa am 21 Okt. 2024

0 Stimmen

Hey @Joschua Kraus, you can make use of vectorizied operations in MATLAB.
Please refer to this documentation.

Kategorien

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

Gefragt:

am 14 Jan. 2018

Beantwortet:

am 21 Okt. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by