readmatrix non-adjacent columns

조회 수: 23 (최근 30일)
Jacob Matson
Jacob Matson 2020년 8월 16일
편집: Walter Roberson 2023년 11월 5일
I would like to import 3 columns of a excel/csv file into a matrix. The columns I want are non-adjacent (Columns C, P, Q). I can import all the columns between C-Q adjacent columns like:
M=readmatrix('file.csv', 'Range', 'C:Q' );
However, I don't wan't columns D-O. I try things like this and it doesn't work.
M=readmatrix('file.csv', 'Range', 'C:C, C:Q' );
How do I only import the 3 colmns C, P, Q into 1 matrix?

채택된 답변

Walter Roberson
Walter Roberson 2020년 8월 17일
편집: Walter Roberson 2023년 11월 5일
readmatrix accepts import options generated with detectImportOptions. You can use selectedVariables option to indicate which variables to read.
  댓글 수: 1
Jose Carrasco
Jose Carrasco 2023년 11월 5일
I would further point out that import options available in one variable can be assessed before using opts.SelectedVariableNames by running detectImportOptions(variable) on it.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by