MATLABŪ Getting Started Guide - The MathWorks - #51

/ 250


catalogue search
P. 51
P. 52
P. 53
P. 54
P. 55
P. 56
P. 57
P. 58
P. 59
P. 60
P. 61
P. 62
P. 63
P. 64
P. 65
P. 66
P. 67
P. 68
P. 69
P. 70
P. 71
P. 72
P. 73
P. 74
P. 75
P. 76
P. 77
P. 78
P. 79
P. 80
P. 81
P. 82
P. 83
P. 84
P. 85
P. 86
P. 87
P. 88
P. 89
P. 90
P. 91
P. 92
P. 93
P. 94
P. 95
P. 96
P. 97
P. 98
P. 99
P. 100


See other catalogues for The MathWorks

Text version of the page
More About Matrices and Arrays
k = find(isprime(A))'
picks out the locations, using one-dimensional indexing, of the primes in the magic square:
k=
2 5 9 10 11 13
Display those primes, as a row vector in the order determined by k,with A(k) ans =
5 3 2 11 7 13
When you use k as a left-hand-side index in an assignment statement, the matrix structure is preserved:
A(k) = NaN
A=
16
NaN
NaN
NaN
NaN
10
NaN
8
9
6
NaN
12
4
15
14
1
2-29

pageCatalog pdf di En 2012-06-22-01