Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
if i have a matrix i want to find some thing in this matrix and put it in a new matrix ?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
if i have an (n,m) matrix A then i want to find some row or column in this matrix and put it in a new matrix like that
A = [ 0 0 1 0 1 1
1 0 1 0 1 1
1 1 0 0 1 0
0 1 0 1 0 1
1 0 1 1 0 1 ]
* if the row or the column have a group of one with one zero between them
* if the number of zero in this row or column < number of ones in this row
then put these rows or these column in a new (n,m) Zeros matrix like that
S_zeros = [ 0 0 0 0 0 1
1 0 1 0 1 1
0 0 0 0 0 0
0 0 0 0 0 1
1 0 1 1 0 1 ]
in S_zeros matrix the Second row in Matrix A apply the condition where
[ 1 0 1 0 1 1 ] >>>> first condition true ( one zeros between the ones )
>>>> second condition true ( number of zeros = 2 , and number of ones = (4)
then ( 2 < 4 )
but in the fourth row
[0 1 0 1 0 1 ] >>>> first condition true ( one zeros between the ones )
>>>> second condition false ( number of zeros = 3 , and number of ones = (3)
then ( 3 < 3 ) wrong
apply this conditions on the rows and columns of Matrix A
3 Commenti
Stephen23
il 15 Apr 2016
Here are some tips to get started:
- Break the problem into parts, and don't try to solve it all at once.
- find out how to loop over rows and columns, test it, check that that works.
- then move on to the next part...
- test and check every part as you write it.
- understand what the code is doing.
- read the documentation (this is a very important step!)
Read this, it has lots of useful advice to learn how to use MATLAB:
and these are some very good tutorials to get you started:
Of course you could ask people to write code for you... but you will not learn as much doing that.
Risposte (0)
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!