Command to import column vectors
65 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am importing .csv files into matlab and usually I just specify the output type to column vectors(as shown in the picture), I was wondering if there is a command line that can do load the file automatically into my variables rather than having to open the import tab and specifying column vectors for each file
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/654745/image.jpeg)
3 Commenti
Stephen23
il 16 Giu 2021
Doing that programmatically is not recommended.
A table is a much better solution (every variable in the table is one column vector).
Risposte (1)
Asvin Kumar
il 23 Giu 2021
Stephen's comment is correct. Each variable in a table is a column vector.
You can see this by selecting the "Generate Script" option from the drop down of the "Import Selection" button.
Here's a sample code which I saw when I generated a script for extracting column vectors:
% set options
% ...
% Import the data
tbl = readtable("somedata.txt", opts);
%% Convert to output type
VarName6 = tbl.VarName6;
'VarName6' was the output column vector.
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Import from MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!