Export Data to excel

조회 수: 1 (최근 30일)
Maxwell MacFarlane
Maxwell MacFarlane 2021년 2월 25일
댓글: Bob Thompson 2021년 2월 25일
I have a lot of .csv files to analyse and have opted to use matlab instead of excel to perfrom the analysis, however, I would like the results from this analysis to be stored in an excel file. I have created a matlab file for each .csv file and want the results from each script to be exported to excel. I opted to operate this way so I did not have to use dynamically assigned variable names.
Could you please help with code that I could add to my script which will add my results to a new row in an excel spreadsheet?
Thank you in advance.
Max
  댓글 수: 3
Maxwell MacFarlane
Maxwell MacFarlane 2021년 2월 25일
Hi Bob,
Do you know how to export results into next available row of an existing spreadsheet?
Bob Thompson
Bob Thompson 2021년 2월 25일
You can export to a specific range with xlswrite, but I don't know an easy way to determine what the next empty row within a file is. The options that I know of are the following:
1) You can detect whether a cell in excel is filled while the file is open in the actxserver, but then you might as well just do this project in VBA.
2) You can read the existing data in the file into a variable, determine the length, and generate a range based on that value, but then you might as well do what I suggested before.
3) If you are performing the operation on all of the csv files in one script you can keep a counter and generate the appropriate excel range based on that counter. This is certainly a functional option, but you would be better off keeping all of your data from your csvs in one array, and just printing once.
There may be a way to look for empty cells that I don't know about, but I can't tell you what it is, because I don't know about 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