How to apply a for loop in all tables with common indexing

3 views (last 30 days)
Usune Elizondo
Usune Elizondo on 27 Sep 2021
Commented: Usune Elizondo on 4 Oct 2021
Hello,
I have a structure where multiple tables are combined. So I can access them by indexing.
I would like to apply a for loop in all the tables that have a common index.
I have more structures like the HYT, I would like to format all the tables that contain FLS in the indexing and all the tables that contain ULS.
So *.FLS. and *.ULS. the HYT. will be different for each structure but FLS and ULS will always be there as well as Float and LR inside each FLS and ULS.
So the variables in the workspace look like this:
HYT
ABC
DEF
then inside each of them we have both FLS and ULS with the Float and LR. I want to apply same actions and calculations to all tables inside FLS and all inside ULS for all the variables in the workspace.
Thank you very much in advance.
  4 Comments

Sign in to comment.

Answers (1)

Shanmukha Voggu
Shanmukha Voggu on 30 Sep 2021
Hi Usene,
Follow the steps in order to achieve the solution
1)Use who and eval to loop over the workspace variables
2)Inside the previous loop start the second loop to iterate over FLS and ULS
3)Finally inside the second loop start the third loop to iterate over FLOAT and LR to make the calculations that are needed to be done on tables
Refer to this for more information.
  4 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!