How to index match excel file in matlab
27 views (last 30 days)
Show older comments
I want to search for an value from an excel sheet and then display that value in matlab
For example,
I want to take input of speed and torque value in matlab
Read the excel file in matlab,
Then with respect to these value i want to search the corresponding value in the excel and return it into matlab.
For example, If I input speed 200 and the torque 20 it should return 62 in my matlab.(refer the excel sheet attached).
Thanks in advance.
0 Comments
Answers (1)
Wan Ji
on 19 Aug 2021
Edited: Wan Ji
on 19 Aug 2021
You can do with following code
T = readtable('example.xlsx', ...
'ReadVariableNames', true,...
'PreserveVariableNames',true,...
'ReadRowNames', true); % read a table
%T('Row1',:) = []; % delete Row1, this line is only to remove unnecessary data
speed = '200';
torque = '20';
T{torque, speed} % get speed = '200' and torque = '20' table value
The result becomes:
ans =
62
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!