hi everyone,
i need urgent help for my code,
i have A=400x5 matrix, and B=0x5 matrix, i want to take the 10th rows(10 20 30 40 50 60) of the A matrix and equal them to the B matrix
for example , B(5,:)=A(50,:) and B(6,:)=A(60,:) goes like this.
please need help.

 채택된 답변

arsenic 陈
arsenic 陈 2021년 5월 10일

0 개 추천

a = zeros(400,5);
b = ones(1,5)
for i = 10:10:400
a(i,:) = b;
end

댓글 수: 2

mehmet salihi
mehmet salihi 2021년 5월 10일
how is going to be the for loop when b=ones(40,5).
this is the difficulity of loop
arsenic 陈
arsenic 陈 2021년 5월 10일
o i thoght B=0x5 matrix it turns out to be 40*5

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

추가 답변 (1개)

John D'Errico
John D'Errico 2021년 5월 10일
편집: John D'Errico 2021년 5월 10일

1 개 추천

Simple. One line. No for loop. Nothing hard.
B = A(10:10:end,:);

댓글 수: 3

mehmet salihi
mehmet salihi 2021년 5월 10일
how is going to be the for loop when b=ones(40,5).
this is the difficulity of loop
mehmet salihi
mehmet salihi 2021년 5월 10일
ok, that is awesome solution. thank you very much
arsenic 陈
arsenic 陈 2021년 5월 10일
good

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

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2021년 5월 9일

댓글:

2021년 5월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by