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

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 2017년 3월 21일
편집: dpb 2017년 3월 21일
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 2017년 3월 21일
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]

댓글을 달려면 로그인하십시오.

 채택된 답변

dpb
dpb 2017년 3월 21일
편집: dpb 2017년 3월 21일

0 개 추천

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.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기

질문:

2017년 3월 21일

편집:

dpb
2017년 3월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by