matlab Is there something like list comprehension as it is in python?

I am looking for something like list comprehensions in matlab however I couldnt find anything like this in the documentary.

In python it would be something like

A=[i/50 for i in range(50)]

Answers


Matlab is very fond of 'vectorizing'. You would write your example as:

A = (0:49) ./ 50

Matlab hates loops and therefore list comprehension. That said, take a look at the arrayfun function.


Need Your Help

How to add a global oncomplete JavaScript method to Richfaces?

javascript jquery richfaces

I'm looking for a possibility to attach a JavaScript method which is always invoked after every AJAX request?

Processing and Pipes

c++ process pipe

Premise: Implement a C++ program that prompts the user for 2 commands. Each input string should be a UNIX command, with arguments allowed. For example, input 1 could be "ls -l" and input 2 could b...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.