How do you write:

x = [1,2,3]
for i in x:
    print i

in matlab?

Recommended Answers

All 2 Replies

This isn't necessarily appropriate for the Python forum but:

len_x = size(x)
for i = 1:len_x
    x(i)
end

Now forgive me, I haven't used Matlab in years; however if you need more help you'll find the MATLAB docs here.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.