Selecting columns from an Excel file

조회 수: 26 (최근 30일)
Shahar ben ezra
Shahar ben ezra 2020년 12월 15일
댓글: Shahar ben ezra 2020년 12월 16일
Hi
When I read an excel file by "readtable" I get the following file as an example
I am interested in getting the frequency range of 102-105 MHz only
How can I cut the file?
Thanks:)
** The original file contains a lot of columns so I am interested in entering the frequency range

채택된 답변

Cris LaPierre
Cris LaPierre 2020년 12월 16일
편집: Cris LaPierre 2020년 12월 16일
Use detectimportoptions and set the opts.SelectedVariableNames to be the variables (columns) you want to import. You can see several examples here. Here is another example from the readtable documenation page.
If your file contains a header row, those names can become the variable names. However, your specific request - having MATLAB figure out which columns to import by just entering a frequency range - is not native functionality. This is not to say you couldn't implement something, but it's on you to create the code to do that.
  댓글 수: 1
Shahar ben ezra
Shahar ben ezra 2020년 12월 16일
Thank you
I needed some direction to figure out how to access the code
If I do not succeed, I will contact you again
Thanks!

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

추가 답변 (1개)

Sandeep Nagisetti
Sandeep Nagisetti 2020년 12월 16일
A similar question has been already answered in the community. You can refer to this link.
  댓글 수: 1
Shahar ben ezra
Shahar ben ezra 2020년 12월 16일
I know this solution,
But he's not good for me,
I want to take my frequency axis
And set the frequency range as a number
And get only the range I requested
I need it this way because the file changes (exits the spectrum)
Therefore the columns are not fixed
Eventually the code will be in the app design so the user will not be able to set columns just frequency range
Hope I was understood :)

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

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by