hi all
how can i change the matrix dimension from 312*1 to 276*1
thank you

댓글 수: 4

Mahdi
Mahdi 2014년 5월 23일
What do you want to do with the values that you're cutting out from the first matrix? Do you want to remove the first 36 values? the last 36 values?
lina
lina 2014년 5월 23일
i have two time period, from 1973-2006 (matrix dim= 408*1) the second one is from 1984-2009 (matrix dim=312*1) so, the period must calculate it is in between (1984-2006) matrix dim=276*1 this is i want to change with.
Mahdi
Mahdi 2014년 5월 23일
Do you know which index that the year 2006 corresponds to in the second matrix? (Where does the data stop for 2006?) Similarly, does your matrix tell you which year corresponds to which data point?
lina
lina 2014년 5월 23일
no it doesnt

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

 채택된 답변

Mahdi
Mahdi 2014년 5월 23일

0 개 추천

Based on what you told me, let's say that the data for the years 1984-2009 is stored in matrix A, you would simply do:
B=A(1:276,1);
Where B is the matrix containing the data from 1984 to 2006 if the year 2006 ends at the 276th row.

댓글 수: 4

lina
lina 2014년 5월 23일
it work with one but it didnt with other
Mahdi
Mahdi 2014년 5월 23일
편집: Mahdi 2014년 5월 23일
What do you mean by the other? For the first matrix, the one from 1973 to 2006, you can do the following (again, assuming the data is in matrix A):
B=A(132:408,1);
lina
lina 2014년 5월 23일
THANK YOU very much
Image Analyst
Image Analyst 2014년 5월 24일
By the way, you're not changing the dimension of your matrix. What's you're doing is extracting a portion of A into a new matrix B. Nothing got changed.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 5월 23일

1 개 추천

Try interp2() or (much, much easier) try imresize() if you have the Image Processing Toolbox.

카테고리

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

태그

질문:

2014년 5월 23일

댓글:

2014년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by