Be the first to rate this file! 16 downloads (last 30 days) File Size: 5.53 MB File ID: #23128

Dynamic field names

by Doug Hull

 

26 Feb 2009

Code covered by BSD License  

Three minute video shows how to use a variable to reference a field of a structure

Download Now | Watch this File

File Information
Description

This short video shows how you can make your code shorter, more flexible, and readable by using a string variable to reference a field in a structure. This is called dynamic field name reference or "dot parens" notation.
                    
You can say:
                    
fName = 'doug'
a.(fName) %this now refers to a.doug
See more videos without downloading here: http://blogs.mathworks.com/videos/category/video/

MATLAB release MATLAB 7.7 (R2008b)
Zip File Content  
HTML Files Video from http://blogs.mathworks.com/pick
Other Files 142 Practical file names.flv,
142 Practical file names.js,
142 Practical file names_config.xml,
142 Practical file names_controller.swf,
142 Practical file names_nofp_bg.gif,
142 Practical file names_preload.swf,
FlashTemplate.css,
ProductionInfo.xml,
swfobject.js
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
video Doug Hull 26 Feb 2009 16:33:02
tutorial Doug Hull 26 Feb 2009 16:33:02
dynamic field name Doug Hull 26 Feb 2009 16:33:02
field Doug Hull 26 Feb 2009 16:33:02
structure Doug Hull 26 Feb 2009 16:33:02
eval Doug Hull 26 Feb 2009 16:33:02
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com