Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
find and replace a value between two arrays

Subject: find and replace a value between two arrays

From: george ts

Date: 11 Jan, 2012 01:27:08

Message: 1 of 2

Hi,
I have two arrays.
The first is like this : A=[1,0;1,0;1,0;2,0;2,0;3,0;3,0;3,0;3,0]
The second is like this B=[1,'M';2,'F';3,'M';4,'F']
 The problem i have is to make an algorithm : to replace in A array the "0"
                                                                              with 'M' when its 1
                                                                              with 'F' when its 2
                                                                               with M when its 3
And if there isn't the value in A array to find next such as 4,'F', that there isn't in A array

PS: this is an example..I have thousands of values in the arrays


I appriciate if you help me!!

Subject: find and replace a value between two arrays

From: Rune Allnor

Date: 11 Jan, 2012 02:06:28

Message: 2 of 2

On 11 Jan, 02:27, "george ts" <qwerty6...@yahoo.gr> wrote:
> Hi,
> I have two arrays.
> The first is like this : A=[1,0;1,0;1,0;2,0;2,0;3,0;3,0;3,0;3,0]
> The second is like this B=[1,'M';2,'F';3,'M';4,'F']
>  The problem i have is to make an algorithm : to replace in A array the "0"
>                                                                               with 'M' when its 1
>                                                                               with 'F' when its 2
>                                                                                with M when its 3
> And if there isn't the value in A array to find next such as 4,'F', that there isn't in A array
>
> PS: this is an example..I have thousands of values in the arrays

Homework?

doc find

Rune

Tags for this Thread

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.

Contact us