Best way to pull every other row from excel?

조회 수: 2 (최근 30일)
chlor thanks
chlor thanks 2020년 3월 11일
댓글: chlor thanks 2020년 3월 12일
I have a row of data in excel that goes something like this:
Anna
34
Brandon
55
Calvin
89
What is the best way to pull these information out into a text file as something like this?
Anna Brandon Calvin
34 55 89
Thank you very much!

채택된 답변

Cris LaPierre
Cris LaPierre 2020년 3월 12일
The challenge here is you are mixing data types. I would recommend using a table with names in one variable and corresponding number in a second variable. Something like this could work.
data = readtable("ChlorThanks.xlsx","ReadVariableNames",false)
name = string(data.Var1(1:2:end));
val = str2double(data.Var1(2:2:end));
newData = table(name,val)
  댓글 수: 1
chlor thanks
chlor thanks 2020년 3월 12일
Thank you! It has been a while since I used matlab and this is a great refresher for me to remember things again, really appreciate your help!

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

추가 답변 (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