Thread Subject: Loop vectorization

Subject: Loop vectorization

From: Prime Mover

Date: 22 Sep, 2011 18:18:55

Message: 1 of 2

Dear friends,

Someone has any suggestion on how to vectorize the loops bellow?

for col=1:ncol

list{col} = unique(data(:,col));
tamlist = length(list{col});

    for i = 1:tamlist
            temp = strmatch(list{col}(i), data(:,col));
            dataconv(temp,col) = i;
    end
end

I thank you in advance.

----------------

Subject: Loop vectorization

From: Prime Mover

Date: 22 Sep, 2011 18:41:00

Message: 2 of 2

Sorry, I forgot to mention that data is also a cell array of strings.


On 22 set, 15:18, Prime Mover <emilso...@gmail.com> wrote:
> Dear friends,
>
> Someone has any suggestion on how to vectorize the loops bellow?
>
> for col=1:ncol
>
> list{col} = unique(data(:,col));
> tamlist = length(list{col});
>
>     for i = 1:tamlist
>             temp = strmatch(list{col}(i), data(:,col));
>             dataconv(temp,col) = i;
>     end
> end
>
> I thank you in advance.
>
> ----------------

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com