Excel to Text Conversion

조회 수: 11 (최근 30일)
Amanda
Amanda 2012년 8월 20일
답변: Fabio Alonso Da Silva 2018년 1월 11일
I can convert the excel file to text manually inside of Excel.
However, to make my MATLAB scripts more autonomous and not relying on
another application, I am struggling with converting a .xlsx file to
text inside of MATLAB. Is there a function or routine to convert a
.xlsx file to .txt?
Thanks,
Amanda
  댓글 수: 1
Akki
Akki 2014년 9월 23일
Is it possible to convert all sheets of a single excel file using single xlsread command?

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

채택된 답변

José-Luis
José-Luis 2012년 8월 20일
편집: José-Luis 2014년 9월 23일
The easy way:
Import to matlab using
[numData textData rawData] = xlsread('myFile.xlsx'), %doc xlsread for more details
and then save to text
save('pqfile.txt', 'rawData', '-ASCII'); %replace rawData with the actual data you are actually interested in.
Cheers
  댓글 수: 2
Amanda
Amanda 2012년 8월 20일
Thanks a lot.
José-Luis
José-Luis 2012년 8월 20일
No worries.

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

추가 답변 (1개)

Fabio Alonso Da Silva
Fabio Alonso Da Silva 2018년 1월 11일
It depends ( people do not like this statement in general), but to do a 'xlsread' and a 'save' right after, have in mind that MATLAB will use memory to do so, possibly creating a cell array. Therefore depending on the size of your file, this can become a memory constraint. Another option is to manually save the MATLAB file as text and then read line by line inside MATLAB so you can direct (or control how) each piece of data goes where. It is a way to get rid of empty spaces creating an useless cell, for instance. Depending also on the size of the generated txt file, you might want to create a way to search and load just the pieces of data of interest into your application, this saves memory, but then increases disk access. There is no free lunch.

카테고리

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