I am wondering how to pull up information in an excel file if the user just inputs keywords into the matlab program? so that when hey enter the key word matlab finds it in the excel file. thanks.
Show older comments
we have an excel file with counties and rainfall, we are trying to have a program that when the user inputs the county name then it will bring up that county in the excel file and desplay the rainfall.
Answers (1)
Accessing Excel files is rather slow; you should read the full Excel file first using XLSREAD, and then work only at MATLAB level. Look at the documentations of XLSREAD and see if you are able to read both names and rainfalls, and then we can talk about a mechanism to associate them both so you can lookup for names and get corresponding data.
You should actually have something like:
[rainfall, county] = xlsread('dataFile.xlsx') ;
One option for the next step is to use STRFIND, that would return the position of a county match in the cell array of counties, which you could use then for indexing rainfall. Let me know if you have no idea about how to go on with that.
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!