checking the existence of timetable and merge

3 visualizzazioni (ultimi 30 giorni)
Sehoon Chang
Sehoon Chang il 3 Set 2020
Modificato: Jon il 3 Set 2020
Hi
within a folder i have diverse excel data type, which are imported and then converted to timetable within MATLAB.
(eg. timetable_csv, timetable_xls,timetable_xlsb, etc.)
It is possible that all of the timetables of various data type exist or only a few types exist depending on the content of the folder.
However, the name of all timetable do exist.
At the end i wish to merge all the existing timetable into one using the code 'outerjoin'.
How may i find out which of the timetables do exist and can be merged with other existing timetables?
I tried to merge each timetables like it is show below. However, the processing stops due to the timetable that do not exist (empty).
timetable = outerjoin(timetable_xltx,outerjoin(timetable_xltm,outerjoin(timetable_xlsx,outerjoin(timetable_xlsm,outerjoin(timetable_xlsb,outerjoin(timetable_csv,timetable_xls))))))

Risposte (1)

Jon
Jon il 3 Set 2020
Modificato: Jon il 3 Set 2020
If it is a question of whether the variables have been created at all, you can check whether they exist using the exist MATLAB command, e.g. and branch accordingly
if exist('timetable_xltm') ...
If the variables always exist, but sometimes there is nothing in them, that is they are empty, you can test for that using the MATLAB command isempty, e.g. and branch accordingly
if isempty(timetable_xltm) ...

Categorie

Scopri di più su Data Type Identification in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by