Reference to a variable
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hi, I am loading a huge amount of data into a database. The database is dynamic and sometimes will hold 50 separate entities and sometime less. Each entity than has a list of up to 10,000 separate variables, each of which is a table of values. I need a way to hold pointers (or references) to the variables to ease later scanning of the database of only particular data. I don't know in advance the number of items in each entity or the number of entities. I was thinking using whos and/or fieldnames to scan the database and get a complete list of all the variable names. But once I have the reference (for example as a string of the var name) how to I access that variable's value? For example if there is a variable called David and its value is 7, and if I have a string 'David', how can I get the value from the string?
0 Commenti
Risposta accettata
Jan
il 4 Mag 2011
What exactly is "a database"? Do you mean a database?
The last sentence of your question sounds like you want to use dynamic fieldnames:
Data.Field1 = rand(3)
Name = 'Field1';
Index = {2, 3}
disp(Data.(Name)(Index{:}))
But the initial part of the question let me assume, that you better use a database program.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Structures 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!