WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

dynamic field names at the beginning of a structure name

 

ukusm
Forum-Newbie

Forum-Newbie


Beiträge: 1
Anmeldedatum: 09.03.20
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 09.03.2020, 16:52     Titel: dynamic field names at the beginning of a structure name
  Antworten mit Zitat      
Hi,

it is clear to me how to define a dynamic field name in a structure name, e.g.

dynName = ['test']

Setting.(dynName) = ...

But is it possible to create a dynamic struct field at the beginning (or not at the end) of a struct name? I tried this way:

dynName = ['test']

(dynName).Setting = ...

But this does not work.
I hope someone could help me out. Many thanks in advance.
Private Nachricht senden Benutzer-Profile anzeigen


Harald
Forum-Meister

Forum-Meister


Beiträge: 24.432
Anmeldedatum: 26.03.09
Wohnort: Nähe München
Version: ab 2017b
     Beitrag Verfasst am: 09.03.2020, 17:16     Titel:
  Antworten mit Zitat      
Hi,

this would be a dynamic variable name. While it can be done using eval, it is not recommended since you are forever stuck with eval afterwards. My recommendation would be to use something like "data" or "test" at the highest level.

Best,
Harald

P.S.: since this is a German language forum, please write in German if possible. If you don't speak German, MATLAB Answers may be a better alternative.
_________________

1.) Ask MATLAB Documentation
2.) Search gomatlab.de, google.de or MATLAB Answers
3.) Ask Technical Support of MathWorks
4.) Go mad, your problem is unsolvable ;)
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2024 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.