Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Could anyone help me to solve the apply the repmat command in the code.

1 view (last 30 days)
A=[ 1 2 3 4 5 31 36 71 72;
11 12 13 14 15 32 37 73 74;
6 7 8 9 10 33 38 75 76;
21 22 23 24 25 34 39 77 78;
26 27 28 29 30 35 40 79 80;
41 42 43 44 45 46 47 81 82;
48 49 50 51 52 53 54 83 84;
85 86 87 88 89 90 91 92 93;
94 95 96 97 98 99 16 17 18]
B=[0 0 61 0 0 0 0 0 0;
65 0 0 0 0 0 0 0 0;
0 63 0 0 0 0 0 0 0;
0 0 0 62 0 0 0 0 0;
0 0 0 0 64 0 0 0 0;
0 0 0 0 0 0 67 0 0;
0 0 0 0 0 68 0 0 0;
0 0 0 0 0 0 0 66 0;
0 0 0 0 0 0 0 0 69]
a=1:9
for r=2:4
for N=2:4
c=randsample(a,N)
C=B(c,:)
non_0=sum(C)
Z =repmat(non_0,r,1)
E=C
E(Z & C ==0)= A(Z & C ==0)
[~,idx]=find(ismember(a,c))
if N==4
else
a(idx)=[]
end
end
end
If i run the code the repmat command was not taking values given in the loop.could anyone help me to fix it.
  4 Comments
Stephen23
Stephen23 on 6 Jan 2018
Edited: Stephen23 on 6 Jan 2018
@Prabha Kumaresan: when you keep asking the same question over and over again, it makes it harder for us to help you. It spreads information (in answers and comments particularly) over many locations, which makes it hard for us to keep track of what you told us and what you have been told.
IF you want help do NOT keep asking duplicate questions
Spamming questions is also very rude on any forum, and is unlikely to make people want to help you. I would suggest that you pay attention to the advice that you have been given.
Simply add comments to existing questions rather than adding new questions. It actually helps you too!
Rik
Rik on 6 Jan 2018
Apparently my answer didn't work for you. Comment below that answer why not.
Not giving up is a virtue, being stubborn isn't. You are asking for help. We are willing to give you that help, but you keep ignoring our advice, hardly reacting to anything we ask, and opening a similar question.

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!