Borrar filtros
Borrar filtros

How to index match excel file in matlab

17 visualizaciones (últimos 30 días)
Shubham Rajesh Yadav
Shubham Rajesh Yadav el 19 de Ag. de 2021
Editada: Wan Ji el 19 de Ag. de 2021
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.

Respuestas (1)

Wan Ji
Wan Ji el 19 de Ag. de 2021
Editada: Wan Ji el 19 de Ag. de 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

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by