hello guys, i have mat file < 15151x723 double > but i want this file with 3 columns only. after 15151 rows i want next 3 columns should come bellow that.same with next 3 columns ...hope you understand...

조회 수: 2 (최근 30일)
hello guys, i have mat file < 15151x723 double > but i want this file with 3 columns only.
after 15151 rows i want next 3 columns should come bellow that.same with next 3 columns ...hop u understand...

채택된 답변

Jan
Jan 2016년 2월 5일
All such resortings can be performed by:
reshape(permute(reshape()))
In you case this could be:
a = [1 2 3 4 5 6; ...
10 20 30 40 50 60; ...
100 200 300 400 500 600; ...
1000 2000 3000 4000 5000 6000]
sizeA = size(A);
b = reshape(permute(reshape(a, sizeA(1), 3, []), [2, 1, 3]), [], 3);
If this does not match your needs, play with the parameters for reshaping and permuting - there is only a limited number of possible combinations, such that you will find the solution fast.

추가 답변 (1개)

Meghana Dinesh
Meghana Dinesh 2016년 2월 5일
Have you tried using reshape?
If
a =
[1 2 3 4 5 6
10 20 30 40 50 60
100 200 300 400 500 600
1000 2000 3000 4000 5000 6000]
Then
b = reshape(a,8,3)
gives:
b =
[1 3 5
10 30 50
100 300 500
1000 3000 5000
2 4 6
20 40 60
200 400 600
2000 4000 6000]
Is this what you want?
  댓글 수: 1
pruth
pruth 2016년 2월 5일
thank you for immediate reply see if have data
a = [1 2 3 4 5 6
10 20 30 40 50 60
100 200 300 400 500 600
1000 2000 3000 4000 5000 6000]
then i want
[ 1 2 3
10 20 30
100 200 300
1000 2000 3000
3 4 5
40 50 60
400 500 600
4000 5000 6000]
but in reality we dont know how much columns and rows we would get(it suppose to be in thousands) for eg. we have data like bellow ,
70.09 205.98 -1 70.09 205.98 -1 70.09 205.98 -1
69.84 205.21 -1 69.84 205.24 -5 69.84 205.21 -1
69.59 204.46 -1 69.59 204.46 -1 69.59 204.46 -1
69.34 203.73 -2 69.34 203.73 -8 69.34 203.73 -8
..
..
..
..
68.29 200.98 -9 68.29 200.98 -1 68.29 200.98 -2
first columns=latitude ,second=longitude, third=data. again forth columns = latitude ,fifth = longitude sixth = data... and so on.... we dont know how columns would come ,it depends on data.here i want only 3 columns,one column for latitude second for longitude and third for data. hope u understand. i m very slow in English.

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

카테고리

Help CenterFile Exchange에서 Automotive에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by