Skip to Main Content Skip to Search
Product Documentation

Pass System.Enum Arguments

Call .NET Methods with System.Enum Arguments

An example of an enumeration is System.DayOfWeek. To see how to call a .NET method with this input type, use the GetAbbreviatedDayName method in the System.Globalization.DateTimeFormatInfo class. The following code displays the abbreviation for "Thursday".

% Create a DayOfWeek object
thisDay = System.DayOfWeek.Thursday;
formatObj = System.Globalization.DateTimeFormatInfo;
% Display the abbreviated name of the specified day based on the 
% culture associated with the current DateTimeFormatInfo object.
formatObj.GetAbbreviatedDayName(thisDay)

To view the function signature for the GetAbbreviatedDayName method, type:

methodsview('System.Globalization.DateTimeFormatInfo')

Search the list for GetAbbreviatedDayName.

Return TypeNameArguments
System.String RetValGetAbbreviatedDayName( System.Globalization.DateTimeFormatInfo this,
System.DayOfWeek dayofweek)

For more information, see:

Use System.Enum in MATLAB

In MATLAB, an enumeration is a class having a finite set of named instances. You can work with .NET enumerations using features of the MATLAB enumeration class and some features unique to the .NET Framework. Some ways to use the System.DayOfWeek enumeration in MATLAB:

For more information, see:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS