How To Apply SWITCH Command For WORD in MATLAB

In previous post we discussed about a matlab tutorial on How to apply switch command for number in MATLAB with its matlab program. Now in Post-16 of Module-01, we will discuss about how to apply switch command for word in matlab.


To understand this problem we are displaying a fixed message for a fixed word i.e. we have assign a keyword for particular message. The matlab program for this has been shown in figure-1.

Figure.1 - MATLAB Program to apply switch command for word.

The basic procedure for this matlab program is similer to matlab program discussed in Post-15 of Module-01. The difference in this matlab program with previous matlab program is that here we are switching between words while previously we switched between numbers. When user type function name 'mod0116' with a word in bracket then word is put after switch command and compare it with each case word. As any case word match with switch word it display it on command window otherwise it display a message 'Unknown Word'. A brief description about each line of code is given in above figure. The command window output of above program is shown in figure-2.

Figure.2 - Command window output of matlab program to apply switch command for word.

When word 'matlab' is typed in command window after function name then it is showing 'Matrix Laboratory'. When word 'mod0116' is typed in command window after function name then it is showing 'Post-16 of Module-01'. When word 'eee' is typed in command window after function name then it is showing 'Electrical & Electronics Engineering'. When word 'psj' is typed in command window after function name then it is showing 'Paramjeet Singh Jamwal'. When word 'info4eee' is typed in command window after function name then it is showing 'Information For Electrical & Electronics Engineering'. When word 'godaddy' is typed in command window after function name then it is showing 'Unknown Word' because godaddy word is not defined in matlab program. This is concluded that we can execute any matlab code by using switch function for words also.

Video Tutorial : How To Apply Switch Command in MATLAB By INFO4EEE


Brought to you by INFO4EEE (Website, Channel, and Classes).

2 comments:

  1. […] Read Post-15 of Module-I: How To Apply SWITCH Command For WORD in MATLAB. […]

    ReplyDelete
  2. […] How to apply switch command for word in MATLAB? In this matlab tutorial, we display a fixed message for a fixed word. […]

    ReplyDelete

Powered by Blogger.