# Creating Several Data Sheets

조회 수: 4(최근 30일)
Sahil R 2021년 3월 25일
답변: Bob Thompson 2021년 3월 25일
Hi all,
I have three excel sheets each containg data with 300 rows and 120 columns. Each sheet have the first column as date (t1, t2, t3, ...) and other columns with data on variable X (X1,...,X119). The sheet 2 and 3 contains data on variable Y and Z, respectively. This is a diagonal data. The data on X1 is up to 160, the data on X2 is up to 161, the data on X3 is up to 162,..., the data on X119 is up to 300. Simarlarly for the other variables.
What I need to do is to get 119 different data sheets containg data on (t1, X1, Y1, Z1), (t2, X2, Y2, Z2),..., (t119, X119, Y119, Z119). Could anyone please help me with this?
Thank you in anticipation.
Best,
SR
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Sahil R 2021년 3월 25일
Yes, it is easy in excel if I have a small set.

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

### 답변(1개)

Bob Thompson 2021년 3월 25일
If you want to performa the reorganization with MATLAB here is an outline of one possible process to do so.
1) Read that three sheets into MATLAB. The current best method is readmatrix, as David mentioned, but a slightly older method is readtable, or xlsread (last resort). You will need one command for each sheet in excel.
2) Data organization in MATLAB. If the data was read directly in as a matrix, then it is quickest to read it in as a single array, so you don't actually need to organize your data again. If read in as tables then the data should be extracted into a 3D matrix.
3) Write data back out to Excel. This can be done with writematrix, or xlswrite. Be sure to call the specific sheet you would like to write to. You will need to perform this operation for each set of data, which will not be efficient. Looping won't speed things up, bit it will allow you to make your code cleaner.

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

### 범주

Find more on Spreadsheets in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by