Rerun script with different table input

3 views (last 30 days)
I wrote quite a long script, that uses table data, like so:
Location = table1.Location;
Is there a way to replace "table1" in all lines of the script and replace it e.g. with table2? To get:
Location = table2.Location;
Additionally I'm relying on tablesizes in my script (probably not a good way to do that) but I manually entered e.g.:
sh(1:2734) = sh;
where (1:2734) represents the table size. Is there a way to have the following?
sh("tablesize") = sh
Thanks for your help!
Lukas Netzer
Lukas Netzer on 5 May 2021
Allready got it! I did it with find and replace ;))

Sign in to comment.

Accepted Answer

David Hill
David Hill on 5 May 2021
You should always attempt to index. Put all your tables into a single cell array.
%then index into t
sh(size(t{n}))=sh;%not sure what you are using this for, but size() gives the size of the table

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by