Seperate column into more columns: 90740x1 double array into 1511x64 something array
이전 댓글 표시
Hello
i have a set of data 90740x1 double. meaning:

what i really want this to do is make a new matrix where i read every 1511 data from this row into a new row. example:

so from 1 to 1511 in column 1 in the new matrix...and from 1511 to 3023 into column 2 in the new matrix etc. etc.
i made a code, it only works for the first 1511 data but after that it displays an error about dimension.
n = 1; for i=1:length(kwh) kunder(:,1) = kwh(1:n:1511); end
so when u put: kunder(:,1) = kwh(1511:n:3023); under the first kunder it displays dimension error...
please help me figure this out..as i want to plot the 24 hour kwh usage data of customers consumption of electricity.
thank you
채택된 답변
추가 답변 (1개)
Azzi Abdelmalek
2014년 4월 8일
Use reshape
reshape(A,1511,64)
댓글 수: 3
awda
2014년 4월 8일
Azzi Abdelmalek
2014년 4월 8일
This is because with 90740 elements you can't get a 1511x64 array which contains 96704 element
Azzi Abdelmalek
2014년 4월 8일
What you can do is to add some nan to your final array
n=90740
A=rand(n,1);
m=ceil(90740/1511)*1511
A(end+1:m)=nan
out=reshape(A,1511,[])
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!