Big Chemical Encyclopedia

Chemical substances, components, reactions, process design ...

Articles Figures Tables About

Use of the Global Command

Step 1 Here, you will set the value of k in the workspace, or calling program, and then it [Pg.116]

Step 2 Next, add the global command to the m-file, called rhs2. (Note you added a numerical identifier to both the calling program and m-file to help keep them straight.) [Pg.117]

Naturally, you expect the same results, which you can verify by running the new code. [Pg.117]

Step 3 Check the code as before, with one addition. It is helpful the first time you mn the code to print out the variables inside the function to make sure they are accessible. If not, MATLAB will tell you that the variable is not defined. Alternatively, use the debugging techniques described in Appendix B. [Pg.117]


If the code you wish to check is in an m-file, the first check is to see that all the parameters are passed correctly and have been set in the workspace available to the m-file. The easiest way to do this is to request that the m-file print all the variables you expect to be transferred to the m-file, at the start of the m-file, and check that they are correct. If a variable has not been set, MATLAB wiU give you an error message without running the code. It tells you the line and column where the undefined variable is. The problem is probably improper passing of parameters or incorrect use of the global command or, sometimes, a typing error. [Pg.243]


See other pages where Use of the Global Command is mentioned: [Pg.116]    [Pg.121]   


SEARCH



Global Command

© 2024 chempedia.info