Azzera filtri
Azzera filtri

How to index match excel file in matlab

18 visualizzazioni (ultimi 30 giorni)
Shubham Rajesh Yadav
Shubham Rajesh Yadav il 19 Ago 2021
Modificato: Wan Ji il 19 Ago 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.

Risposte (1)

Wan Ji
Wan Ji il 19 Ago 2021
Modificato: Wan Ji il 19 Ago 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

Categorie

Scopri di più su Data Import from MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by