how to set more than 1 value to this code?
1 view (last 30 days)
Show older comments
Hi...this is my code. rs = m; n=7;
OFF = [m n];
A=zeros(m,n);
B = repmat(eye(n),ceil(m/n),1);
i1 = randi(n); % start in i1'th column
Bout = circshift(B,[0 i1-1]);
Bout = Bout(1:m,:);
this code is just functioning for 1 value..how can i add one more value without change the matric?
Accepted Answer
Azzi Abdelmalek
on 1 Sep 2012
Edited: Azzi Abdelmalek
on 1 Sep 2012
you have already posted this question,
x=1; n=13,m=7,n1=5 ; A=zeros(n,m);% n1 is your random number
A(sum([ 1:n; mod(n1-1:n+n1-2,m)*n]))=x
%if you want add another x and n1 without changing A
x=2;n1=4 % for example
A(sum([ 1:n; mod(n1-1:n+n1-2,m)*n]))=x
%you can repeat this as you want
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!