Info

此问题已关闭。 请重新打开它进行编辑或回答。

can someone help me convert the for loop to a while loop

1 次查看(过去 30 天)
function [ cumsum ] = q2(v) n = length(v); cumsum = zeros(1,n); for ii = 1:n if ii == 1 cumsum(ii) = v(ii); else cumsum(ii) = cumsum(ii-1)+v(ii); end end end

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by