Fix dynamically named variables
조회 수: 1 (최근 30일)
이전 댓글 표시
I am working with data from another program that dynamically names table variables. This needs to be corrected to make my script work.
Currently Vartable.Properties.VariableNames=
{'VarA_f01_01/01/2021'} {'VarB_f01_01/01/2021'} {'VarC_f01_01/01/2021'}
I would like this to look like
{'VarA'} {'VarB'} {'VarC'}
Is there a way to do this for multiple variable names without a bunch of if contains statements?
The variable names are in a standardized format but the numbers dates and letters will change. Sometimes certain variables will not be present and only VarA and VarC may be in the table which further complicates things.
Any help is appriciated.
댓글 수: 2
Jeff Miller
2021년 5월 3일
It's hard to tell from these examples what the full range of "before" and "after" variable might be. For the names shown, for example, it would be sufficient to rename each variable with the part of its original name preceding the first underscore. Would that always work?
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Two-Phase Fluid Library에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!