Use writetable to everything in the workspace

조회 수: 2 (최근 30일)
Arthur Romeu
Arthur Romeu 2020년 4월 3일
댓글: Arthur Romeu 2020년 4월 6일
Hello there,
I have a script that outputs many different Nx2 tables that contain the same type of information, being column 1 a "Status" column and column 2 a datetime column. I am currently trying to put them all in a single .xlsx file sorted by their datetimes. The thing is: Depending on the input data on the beggining of the script, some tables will not be written in the first place, so the situation is as follows:
All the tables have to be in the .xlsx file, but I can't simply use their name to call them because if some table doesn't exist on the run, matlab will report that said table doesn't exist.
I'll attach some output tables for better understanding.
I hope I was clear enough for you guys to have a picture of the problem that I'm facing.
Thanks in advance,
Arthur.
  댓글 수: 3
Stephen23
Stephen23 2020년 4월 3일
This is exactly why splitting data into lots of separate variables just makes it harder to work with.
Put the data into one variable (it could be a cell array, a table, a structure, whatever suits your data) and then simply iterate over the appropriate indices/fields/rows or whatever. Designing your data better would improve your code a lot.
Arthur Romeu
Arthur Romeu 2020년 4월 6일
That's true! However, the source of these data is different for each one of them. I'll try and put them in one var.. I'm fairly new to programming :)

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

답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by