How to select specified data from a spreadsheet using MATLAB?

조회 수: 9 (최근 30일)
Janice Sanderson
Janice Sanderson 2016년 1월 17일
댓글: Janice Sanderson 2016년 1월 17일
Hi, I'm currently working on a prediction model on MATLAB and got stuck on the data processing part.
I input a spreadsheet with multiple variables, and I am only interested in the integrated load of the CENTL area. I would like to create a number array of the Integrated load from CAPITL area, but I'm not sure how. Is there a function in MATLAB similar to the "filter" function in Excel?
I'm a beginner here, I'd really appreciate your help!
Thanks in advance!

답변 (1개)

Image Analyst
Image Analyst 2016년 1월 17일
편집: Image Analyst 2016년 1월 17일
Read in the data with readtable(), or with xlsread() if you have an old version of MATLAB. Then use ismember() to select only those rows with CENTRL in the name column. It's something like
t = readtable(filename);
rowsToExtract = ismember(t.Name, 'CENTRL');
centrl = t(rowsToExtract, :); % sub-table.
integratedLoad = centrl{:, 5};
or something like that. I'd maybe have done it for you but you didn't attach your workbook with the paperclip icon. But no problem, you'll probably learn more by doing it yourself anyway. Good luck.
  댓글 수: 1
Janice Sanderson
Janice Sanderson 2016년 1월 17일
Great this really helped! This is much more easier than what I was doing! The ismember() is a great function! Thank you so much!!

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

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by