How can I write "n" "for loops" just by a single command?

I am interested in writing "n" "for loops" with variables "Var(i)" all varying from 1 to k, just by a single command. In other words I want to make the code automatic instead of writing n for loops manually (please see below). I appreciate your help.
for Var(1) = 1:k
for Var (2) = 1:k
.
.
.
for Var(n) = 1:k
y = f(Var(1),Var(2),...,Var(n))

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 12 Dec 2013

Commented:

on 30 Oct 2020

Community Treasure Hunt

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

Start Hunting!