how to set more than 1 value to this code?
조회 수: 2 (최근 30일)
이전 댓글 표시
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?
채택된 답변
Azzi Abdelmalek
2012년 9월 1일
편집: Azzi Abdelmalek
2012년 9월 1일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!