How to index match excel file in matlab

18 次查看(过去 30 天)
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.

回答(1 个)

Wan Ji
Wan Ji 2021-8-19
编辑:Wan Ji 2021-8-19
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

类别

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