matrix multipication per elements and convert to char
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
hi, any solution with this matrix multipication??
pop =
9 0 -2 3 -4
8 -9 1 0 -3
7 -8 9 -1 2
6 -7 8 -9 1
if pop > 0,
m = [2*pop-1 2*pop; 2*pop 2*pop-1];
elseif pop == 0
m = [2*i+1 pop;2*i-1 pop]; % i is number of row's
elseif pop < 0,
m = [2*pop+1 2*pop; 2*pop 2*pop+1];
end
here's a resul's what i need:
17 18 2 0 -3 -4 5 6 -7 -8
18 17 1 0 -4 -3 6 5 -8 -7
15 16 -17 18 2 2 4 0 -5 -6
16 15 -18 -17 2 2 3 0 -6 -5
13 14 -16 -16 17 18 -2 -2 3 4
14 13 -16 -16 18 17 -2 -2 4 3
11 12 -14 -14 16 16 -17 -18 1 2
12 11 -14 -14 16 16 -18 -17 2 1
i appreciate a lot for any attention.. thx before
4 Commenti
Friedrich
il 7 Mar 2012
If pop is really the matrix above, than none of the formulas for m will generate the matrix you want. Could you explain a bit more how the resulting matrix should be generated? So which laws should be applied on the input matrix?
In addition, your if else brance is never true at all, e.g. this will display never the word true:
if pop > 0
disp('true')
elseif pop == 0
disp('true')
elseif pop < 0
disp('true')
end
So what do you want achive exactly?
Jan
il 7 Mar 2012
There was a very similar question some days ago - it used "a" instead of "pop". But I cannot find it anymore. Has it been deleted to increase our confusion?
The operation should happen elementwise, so each element is replaced by [2*pop(i,j)-1, 2*pop(i,j); 2*pop(i,j), 2*pop(i,j)-1]
mashudi
il 7 Mar 2012
mashudi
il 10 Mar 2012
Risposte (0)
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!