From: Walter Roberson on 10 Jun 2010 15:03 fckool wrote: > c=mod(m*G,2) > ´ > but it give me an error: > ??? Error using ==> mtimes > Inner matrix dimensions must agree. > > G it's an array calculated before this. * is the Matrix Multiplication operator. As per usual, m*G is only possible if the second dimension of m is the same as the first dimension of G. If you want to multiply each corresponding element of m by each corresponding element of G, then use m .* G . By the way, watch out for m1 versas m .
From: dpb on 10 Jun 2010 15:05 fckool wrote: .... > c=mod(m*G,2) > ´ > but it give me an error: > ??? Error using ==> mtimes > Inner matrix dimensions must agree. > > G it's an array calculated before this. Well, "*" is matrix multiplication in Matlab so one must have conformant array sizes for the operation as defined by matrix operations. If G is same dimensions as m and you mean element-wise mulitplication, that's ".*" in Matlab doc times doc mtimes --
From: fckool on 10 Jun 2010 13:28 with the code that I showed you, it works... but I cant use it.. I have to use another one.. Your code maybe not work because when you add a space (string value?) you are increasing the array dim, not? who can I separate the bits, for a better read, without increase its size?
From: Walter Roberson on 10 Jun 2010 17:48 fckool wrote: > Your code maybe not work because when you add a space (string value?) you are increasing the array dim, not? It does increase the dimensions, but that isn't necessarily a problem. > who can I separate the bits, for a better read, without increase its size? m = repmat(' ', 2^k, k); for i = 1 : 2^k m(i,:) = dec2bin(i-1,k); end mdisplay = repmat(' ', 2^k, 2*k-1); mdisplay(:,1:2:2*k-1) = m; Or, if you prefer an expression over efficiency, mdisplay = cell2mat(arrayfun(@(c) [c ' '], m, 'Uniform',0))
From: fckool on 10 Jun 2010 14:58 perfect, know it works. I have to explain every line of my program can you to explain this 2 lines please?: mdisplay = repmat(' ', 2^k, 2*k-1); mdisplay(:,1:2:2*k-1) = m; The efficient expression it's very good but I never gonna get it explains by myself lol.. I have another question: how can I test the efficiency of my code? (how much time it need to run) thank you very much, and i apology if I'm being boring.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Pulling parametric uncertainty out of a model Next: cut out false data |