Reputation: 388
I have a script that analyzes data from a csv using xlsread
but I need to run the script on Linux, and I am currently using Windows10, so xlsread
does not work. I have tried to use the 'basic' parameter, but that does not work.
data = xlsread("set1.csv"); % this extracts data that are integers or binary (TRUE/FALSE)
[~, data_id] = xlsread("set1.csv","A2:A10"); % this extracts the first column, which has subject IDs which are strings
I have tried to use importdata
which gives me a structure with data
and textdata
, but (a) I do not know why data
has only 2 columns (of numeric type) even though there are many more and (b) textdata has all column data as strings, but the headers from my original csv do not match the columns within textdata: The headers are all applied to the first column, so the first column has all the headers, separated by commas, and the other columns do not have headers.
I want to be able to grab the data from my csv using something comparable to xlsread
that works in Linux. I have looked around with readtable
, readmatrix
, readcell
, importdata
, but I have not found anything that gives me exactly what I want, since the data within my .csv are mixed type: strings, integers, binary.
Upvotes: 1
Views: 160
Reputation: 142
Use the import tool on the toolstrip. You can then generate the code that was run to import the data you selected.
Upvotes: 1