Command to import column vectors

조회 수: 59 (최근 30일)
Ahmed Abdulla
Ahmed Abdulla 2021년 6월 16일
답변: Asvin Kumar 2021년 6월 23일
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
  댓글 수: 3
Ahmed Abdulla
Ahmed Abdulla 2021년 6월 16일
Unfortunately the following solution imports the full file as a table, not as column vectors :(
Stephen23
Stephen23 2021년 6월 16일
Doing that programmatically is not recommended.
A table is a much better solution (every variable in the table is one column vector).

댓글을 달려면 로그인하십시오.

답변 (1개)

Asvin Kumar
Asvin Kumar 2021년 6월 23일
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.

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by