Importing a two column array from excel
Show older comments
I'm trying to import an excel file, read data from the file into my code. I've tried the import data tool and it opend the data in a new tab. I don't know how to tell my program to read the program from that new tab that is call Variables-chirpdata. When I run the program, it also deletes all the data in the Variables-Chirpdata tab.
I've also tried all of these ways
T = readtable(chirp_data.xlsx)
numData = xlsread('chirp_data.xlsx')
switchpos = numData(:;2);
to call it directly from the file i keep getting error messages of "Unable to resolve the name chirp_data.xlsx." or "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters."
Answers (1)
Rik
on 2 Oct 2020
1 vote
You forgot to put the quotes in your first call. That makes Matlab treat it like a variable, not a char array.
3 Comments
Adam Salley
on 2 Oct 2020
Rik
on 2 Oct 2020
If you don't actually want a table I would suggest checking if one of the three outputs of xlsread do what you want. Otherwise you can use the normal syntax for tables to manipulate your data. I'm on mobile and I don't work with tables, so I can't easily give you an example.
madhan ravi
on 2 Oct 2020
T = readtable('chirp_data.xlsx');
Wanted = T{:, 2}
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!