How to divide a row vector to 6 small row vector with faster technique?

조회 수: 6 (최근 30일)
Louis Liu
Louis Liu 2017년 8월 26일
댓글: Louis Liu 2017년 8월 26일
Hello, dose anyone can give me an advice of the problem below? Thanks!
problem: I got a 1-by-366 row vector now. However, I need to divide it to get the six small row vector which size of everyone is 1-by-61 and then use plot() to illustrate the plot like plot(x,c(1),x,c(2),x,c(3),x,c(4),x,c(5),x,c(6))
I can assign every one slowly like c(1) = b(1:61),c(2) = b(62:122)... but I also want to know the faster technique maybe like for loop or other method and I can apply it when I encounter some case need to divide more small row vector. Thanks!

채택된 답변

KSSV
KSSV 2017년 8월 26일
doc reshape. This would be faster....
A=rand(1,366);
B=reshape(A,6,[]);
  댓글 수: 5
John D'Errico
John D'Errico 2017년 8월 26일
What happens if you call plot like this:
plot(1:61,cumsum(rand(61,6)))
What does this do? TRY IT. And READ THE HELP FOR PLOT!
Louis Liu
Louis Liu 2017년 8월 26일
@Stephen Cobeldick @John D'Errico Thank for your help! I think I am too lazy because English content is too hard for me to understand... I will quit this bad habit and read more doc before I ask the question in the next time. Thank you again!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!