Hello I have a row containing 120 elements i want to convert this row to 16*16 diagonal matrix with 0 in the diagonal. I tried commands like reshape and diag but still not successful. Someone please give me insight.
EDIT:
Hello Thank you guys for answers. Sorry i didnt provided much details before:
I have data from a tomography device which i need to convert it to a matrix for the software to read the data i have is in this form 1 row and 120 columns:
M(1x120)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
But the software understand this in the following format:
Please give me some insights how can i do it.
3 Comments
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/506210-converting-a-row-to-diagonal-matrix#comment_799038
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/506210-converting-a-row-to-diagonal-matrix#comment_799038
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/506210-converting-a-row-to-diagonal-matrix#comment_799049
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/506210-converting-a-row-to-diagonal-matrix#comment_799049
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/506210-converting-a-row-to-diagonal-matrix#comment_799383
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/506210-converting-a-row-to-diagonal-matrix#comment_799383
Sign in to comment.