Reading Specific Data Into MATLAB from an Excel File
이전 댓글 표시
I need to read data from the attached file into my program in MATLAB. How do I do this? I only need the columns listed below:
ismart_02_MAN x
ismart_02_MAN y
ismart_02_MAN z
ismart_02_RASI x
ismart_02_RASI y
ismart_02_RASI z
ismart_02_RLEPI x
ismart_02_RLEPI y
ismart_02_RLEPI z
ismart_02_RLMAL x
ismart_02_RLMAL y
ismart_02_RLMAL z
ismart_02_RTOE x
ismart_02_RTOE y
ismart_02_RTOE z
댓글 수: 2
KSSV
2019년 2월 11일
YOu note down those columns......and pick only those columns by specifying range while reading using readtable or xlsread
Allison Bushman
2019년 2월 11일
답변 (1개)
Guillaume
2019년 2월 11일
One way:
opts = detectImportOptions('Static_pose.xlsx'); %should automatically figure out what part of the excel file is a table
opts.SelectedVariableNames = opts.SelectedVariableNames(contains(opts.SelectedVariableNames, {'MAN', 'RASI', 'RLEPI', 'RLMAL', 'RTOE'})); %only keep variables with MAN, RASI, etc. in their name
t = readtable('Static_pose.xlsx', opts) %read table with only the selected variable names
Another way, if you want to look at other columns before keeping only the ones you want:
opts = detectImportOptions('Static_pose.xlsx'); %should automatically figure out what part of the excel file is a table
fulltable = readtable('Static_pose.xlsx', opts); %get table with all the columns
filteredtable = fulltable(:, contains(fulltable.Properties.VariableNames, {'MAN', 'RASI', 'RLEPI', 'RLMAL', 'RTOE'})); %only keep variables with MAN, RASI, etc. in their name)
I would think you may also want to keep the Frame column.
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!