Reading Specific Data Into MATLAB from an Excel File
2 次查看(过去 30 天)
显示 更早的评论
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
回答(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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!