help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resolution exercise Octave


From: Francesco Potortì
Subject: Re: Resolution exercise Octave
Date: Tue, 21 Apr 2020 14:12:05 +0200

>I am trying to solve an exercise on Octave and would like some help.
>I have a matrix A (10x5) with numbers from 1 to 80 random.
>From this matrix, 5 numbers are drawn, forming matrix B (1x5).
>I need to generate another matrix (10x5), where the numbers in matrix B are
>equal to A returns the value 1 and if different, returns the value 0. How
>can I do this?

Do you need to just make it work?  If yes, this is good enough and does
not require much Octave competence:

Simone Zampini:
>I think that a couple of "for" loops are enough.
>
>Check each element and place there 0 or 1.

If you need to demonstrate a good grasp on the vector operators you
should vectorialise you code.  The basic step is to create a new 10x5
matrix to which matrix A should be compared.

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it



reply via email to

[Prev in Thread] Current Thread [Next in Thread]