How to extract data from data file?
Show older comments
I have an .xls file which consists of 1st column is dates and time and other n rows and n columns data.... in this file, I want to extract data from between 8/9/2015 21:00 to 8/10/2015 9:00 then next 8/10/2015 21:00 to 8/11/2015 9:00 like wise for same all interval in one output file.
Input: 8/9/2015 9:00 1392 14.51 11.57 11.37 8/9/2015 10:30 1395 13.97 15.4 14 8/9/2015 12:00 1398 13.93 17.11 16.4 8/9/2015 13:30 1401 13.87 18.64 17.44 8/9/2015 15:00 1404 13.86 19.66 17.73 8/9/2015 16:30 1407 13.88 19.23 16.19 8/9/2015 18:00 1410 13.61 16.55 14.56 8/9/2015 19:30 1413 12.92 13.51 12.38 8/9/2015 21:00 1416 12.58 10.91 10.95 8/9/2015 22:30 1419 12.54 10.24 10.53 8/10/2015 0:00 1422 12.51 9.74 10.13 8/10/2015 1:30 1425 12.49 9.52 9.98 8/10/2015 3:00 1428 12.47 10.28 10.13 8/10/2015 4:30 1431 12.46 9.4 8.96 8/10/2015 6:00 1434 12.46 9.02 8.97 8/10/2015 7:30 1437 13.22 9.45 9.59 8/10/2015 9:00 1440 14.52 11.44 10.5 8/10/2015 10:30 1443 14.03 13.71 11.88 8/10/2015 12:00 1446 13.99 14.58 12.76 8/10/2015 13:30 1451 13.97 16 14.13 8/10/2015 15:00 1452 13.96 15.99 13.57 8/10/2015 16:30 1455 14.01 14.77 12.96 8/10/2015 18:00 1458 13.96 14.56 12.3 8/10/2015 19:30 1461 12.98 11.28 10.47 8/10/2015 21:00 1464 12.6 9.17 9.45 8/10/2015 22:30 1467 12.55 7.962 8.86 8/11/2015 0:00 1470 12.52 7.958 8.65
Output: 8/9/2015 21:00 1416 12.58 10.91 10.95 8/9/2015 22:30 1419 12.54 10.24 10.53 8/10/2015 0:00 1422 12.51 9.74 10.13 8/10/2015 1:30 1425 12.49 9.52 9.98 8/10/2015 3:00 1428 12.47 10.28 10.13 8/10/2015 4:30 1431 12.46 9.4 8.96 8/10/2015 6:00 1434 12.46 9.02 8.97 8/10/2015 7:30 1437 13.22 9.45 9.59 8/10/2015 9:00 1440 14.52 11.44 10.5 8/10/2015 21:00 1464 12.6 9.17 9.45 8/10/2015 22:30 1467 12.55 7.962 8.86 8/11/2015 0:00 1470 12.52 7.958 8.65 .......... ... ... ... ...
and so on ....
3 Comments
Preethi
on 18 Jan 2017
hi,
you can use xlsread() function.
Sunil Oulkar
on 18 Jan 2017
Shubhangi Saini
on 19 Feb 2019
If it is a csv file then you can use
Pin_data = csvread('spect - Sheet1.csv');
col1 = Pin_data(:, 1); // to extract the data of 1st column
col2 = Pin_data(:, 2); // to extract the data of 2nd column
I hope this may help .
Accepted Answer
More Answers (1)
Nnamdi Onwuegbuchu
on 9 Jun 2022
0 votes
Hi roomies, pls how can i extract imported data on matlab before sending it to model trainer
Categories
Find more on Data Type Identification 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!