Changing elements with a condition
Mostra commenti meno recenti
Hi all,
I've some basic questions about changing the elements of a 9x9 matrix with a specific condition. The matrix is;
X1 =
0 0 0 0 0 0 0 0 0
0.2778 0.2800 0 0 0 0 0 0 0
0.2222 0.2000 0.3700 0 0 0 0 0 0
0.1333 0.1600 0.1750 0.4600 0 0 0 0 0
0.0889 0.0960 0.1400 0.1500 0.5950 0 0 0 0
0.0667 0.0640 0.0840 0.1200 0.1125 0.5950 0 0 0
0.0611 0.0480 0.0560 0.0720 0.0900 0.1125 0.6400 0 0
0.0444 0.0440 0.0420 0.0480 0.0540 0.0900 0.1000 0.6400 0
0.0222 0.0320 0.0385 0.0360 0.0360 0.0540 0.0800 0.1000 0.6400
And I want to create X2 as
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0.278 0.280 0 0 0 0 0 0
0 0.222 0.200 0.370 0 0 0 0 0
0 0.133 0.160 0.175 0.460 0 0 0 0
0 0.089 0.096 0.140 0.150 0.595 0 0 0
0 0.067 0.064 0.084 0.120 0.113 0.595 0 0
0 0.061 0.048 0.056 0.072 0.090 0.113 0.640 0
0 0.044 0.044 0.042 0.048 0.054 0.090 0.100 0.640
And X3 as
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0.278 0.280 0 0 0 0 0
0 0 0.222 0.200 0.370 0 0 0 0
0 0 0.133 0.160 0.175 0.460 0 0 0
0 0 0.089 0.096 0.140 0.150 0.595 0 0
0 0 0.067 0.064 0.084 0.120 0.113 0.595 0
0 0 0.061 0.048 0.056 0.072 0.090 0.113 0.640
Thanks to everyone for solution.
;
2 Commenti
Rik
il 21 Dic 2018
You mean you want to make a copy and assign zeros to specific rows and columns?
Onur Güven
il 21 Dic 2018
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!