Let the
big matrix= [15 0 -50 23 0 0 75]
small matrix=[1 0 1]
required matrix=[15 1 -50 23 0 1 75]
retaining all other values as it is

3 comentarios

ES
ES el 21 de Mzo. de 2017
Please explain with a small example..
say Big Matrix = [1.5, 3.5, 0, -6, 1.3]
Small Matrix = [0, 1, 1]
What would your output be?
dpb
dpb el 21 de Mzo. de 2017
Editada: dpb el 21 de Mzo. de 2017
Put the question itself in the space for it with a short title in the title box...as the other respondent says, an minimal example illustrating what you mean, precisely, would be helpful.
Jatin chinchkar
Jatin chinchkar el 21 de Mzo. de 2017
let the big matrix= [15 0 -50 23 0 0 75] small matrix=[1 0 1] required matrix=[15 1 -50 23 0 1 75]

Iniciar sesión para comentar.

 Respuesta aceptada

dpb
dpb el 21 de Mzo. de 2017
Editada: dpb el 21 de Mzo. de 2017
Taking a guess, without any error checking (there would have to be a minimum of length(shorter) zero elements in the longer array to avoid an error) assuming that "encrypt the 1,0 of smaller into only in zero values of larger" means to put the values of the shorter array into the zero locations of the larger in series, that's pretty trivial--
N=numel(short); % number in shorter
ix=long(ix==0); % logical array of zero loc's in longer array
long(ix(1:N))=short; % put that many elements into long at zero loc's
Perturbations of the above depending upon what other specific readings one makes of the request.
ADDENDUM
Well, the crystal ball was working this morning after all...
>> bigm=[15 0 -50 23 0 0 75];
smallm=[1 0 1];
>> bigm(bigm==0)=smallm
bigm =
15 1 -50 23 0 1 75
>>
NB: Above IFF
length(smallm)==sum(bigm==0)
otherwise need the previous length tests/truncation/whatever for error handling.

Más respuestas (0)

Categorías

Más información sobre Encryption / Cryptography en Centro de ayuda y File Exchange.

Preguntada:

el 21 de Mzo. de 2017

Editada:

dpb
el 22 de Mzo. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by