Using imported lookup tables from Excel
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am new to Matlab and want to use lookup tables. Using the Matlab help on lookup tables I found the following code to import a lookup table form excel -
% Import the data from Excel for a lookup table
data = xlsread('MySpreadsheet','Sheet1');
% Row indices for lookup table
breakpoints1 = data(2:end,1)';
% Column indices for lookup table
breakpoints2 = data(1,2:end);
% Output values for lookup table
table_data = data(2:end,2:end);
I have copied the excel file in the Matlab folder too. Now how do I actually lookup values from the table? What is the command/function? Will I have to necessarily use Simulink?
0 Kommentare
Antworten (1)
Abhisek Roy
am 28 Feb. 2017
Hi Fiona,
Have a look at the following documentation page for interp1. This command allows you to create a 1-D lookup table with your choice of interpolation and extrapolation methods in MATLAB. You can also have a look at 'interp2', 'interp3' and 'interpn' commands for your reference.
In this case, I think that interp2 command will suit your requirement. So, if you see the function signature,'V' will be the data, which you have imported from the EXCEL file and you will need to give coordinates of the sample points as X and Y. Please have a look at the examples given in documentation page for better understanding.
Abhisek
0 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!