Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

function for loop

$
0
0
> function n=test(ni)
>
> for i=1:n
>
> x=i;
>
>
> n=[x,0,0];
>
> end
>
> end
>
> ie ni=4
>
> result is just "4 0 0"
> why I cannot see other possibilities for i=1,2,3... s.t
> for ni=4, my expectation is
> 100
> 200
> 300
> 400

Viewing all articles
Browse latest Browse all 2703

Trending Articles