Previous Next        Current Page: NeXtMidas Training / Macros - Part 1 (Basics) / Macro Basics / Lab 1 - Macro Basics / Instructions
back
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
   - Macro Basics   
      - What is a Macro?   
      - Types of Macros   
      - Local vs Global Results   
      - Macro Structure   
      - Lab 1 - Macro Basics   
         - Instructions   
         - Solution   
      - Lab 2 - Macro Basics   
         - Instructions   
         - Solution   
   + Loops and Control Structures   
   + Procedures and Subroutines   
   + Pipes in a Macro   
   + Messages in a Macro   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Lab 1 - Macro Basics:
    • Using a text editor, create a new file named mcrlab1.mm.
      • Put the file in your home directory.
    • At the top of the macro insert a comment with your name.
    • Now add the appropriate STARTMACRO and ENDMACRO lines.
    • Your macro will take in three parameters:
      NAME A person's name.
      FEET The person's height in feet (no inches).
      INCHES The person's height in inches (less any feet).
    • In the macro compute the persons height in centimeters (cm). You can use the conversion 1cm = 0.3937in. Drop of any fractional centimeters.
    • Use INFO to print out how tall the person is.
    • Try using your macro.
      nM> %mcrlab1 "Lee" 5 6
      INFO: Lee is 167cm tall [%MCRLAB1]
      
    • Hint: To drop the decimal place, you can use type L (long integer) instead of D (double) for your result variable.

back