I have a data set that is saved as a .csv file that looks like the following:
Name,Age,Password
John,9,\i1iiu1h8
Kelly,20,\771jk8
Bob,33,\kljhjj
In R I could open this file by the following:
X = read.csv("file.csv",header=TRUE)
Is there a default command in Matlab that reads .csv files with both numeric and string variables? csvread
seems to only like numeric variables.
One step further, in R I could use the attach function to create variables with associated with teh columns and columns headers of the data set, i.e.,
attach(X)
Is there something similar in Matlab?
attach
does in R. It only exposes the column names to the enclosing environment. The difference is crucial since alterations to those variables will not persist whendetach(X)
is executed. The use ofattach
is discouraged. – Firstborntextscan
to solve this problem, notxlsread
. The linked answer provides very little information ontextscan
- just a link to the documentation really. – Storer