필터 지우기
필터 지우기

Read from *.txt file and write to excel file

조회 수: 50 (최근 30일)
Sapir Zuriat
Sapir Zuriat 2022년 5월 4일
편집: Pratik Pawar 2022년 5월 18일
I need to read with Matlab from *.txt file which have few columns - let's say 10 columns.
after I read it, I need to analyze this data and to make graphs in new excel file.
what are the recommended ways for doing a mission like this?
thank you for your help in advance :)
  댓글 수: 3
Sapir Zuriat
Sapir Zuriat 2022년 5월 4일
I try to understand how can I read the data from *.txt file?
in addition, it is fine to have the processed data in Excel.
Johannes Hougaard
Johannes Hougaard 2022년 5월 4일
Could you include an example of your txt file?
I think your cause of action would include something using readtable and writetable, but if you include a txt file and some of the code bits that didn't do it for you it would be way easier to help you

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

답변 (1개)

Pratik Pawar
Pratik Pawar 2022년 5월 18일
편집: Pratik Pawar 2022년 5월 18일
You can use the 'readtable' function to read column-oriented data from .txt file and the 'writetable' function to export data from workspace to any worksheet in the file or to any location within that worksheet.
Please refer to the code below:
>> T = readtable('myTxtFile.txt');
% Here you can analyze this table data
>> filename = 'myExcelFile.xlsx';
>> writetable(T, filename, 'Sheet', 1);
For example, suppose you have a text file myTxtFile.txt as shown below, then the code will generate myExcelFile.xlsx after execution.
myTxtFile.txt myExcelFile.xlsx

카테고리

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