Вы находитесь на странице: 1из 6

Helpful Hints for Using MATLAB Online

The latest revision of this file occurred 4/25/16 8:10 AM Central Daylight Time

Much of MATLAB Online is the same as the installed version, but there are differences. Some of those
differences are highlighted in the Video entitled, “MATLAB Online”, but not all of them. Most of the
differences that affect this course will be found in this file. The file will be updated and corrected as the
course progresses and more features of MATLAB Online are encountered. To determine when the latest
changes were made to this file, note the revision date above.

Autocorrect

Auto correction of commands in the Command Window is different in installed MATLAB and MATLAB
Online. In both versions, if the user types a command that is unknown to MATLAB but has a spelling that
is similar to an alternative command known to MATLAB, for example helo instead of help, MATLAB will
suggest the alternative. The versions behave as follows:

(1) The installed version types “Did you mean: help” and waits for the user to confirm. The user can
confirm by hitting the Enter key to execute the alternative command.
(2) MATLAB Online types “Did you mean: help ?” but, instead of waiting for the user to confirm by
typing Enter, leaves it up to the user to retype the command and hit Enter.

Comment wrapping in the Editor Window

Installed versions of MATLAB provide a means for automatically “wrapping” comments, meaning that
consecutive lines of comments in the code are rearranged so that they have roughly the same width.
MATLAB Online does not provide comment wrapping. However, while they help the reader of the
program to understand how that program works, comments, and their arrangements are only cosmetic.
They have no effect on how MATLAB executes the code.

Copy and Paste Text

Here is how to copy and paste text from and to the Command window and the Editor window:

(1) Copying
a. With the mouse or touchpad, highlight the text to be copied (click left, drag the pointer over the
text, and release).
b. Copy the text into the clipboard using one of these methods:
1. On the keyboard, hit Ctrl+c (Microsoft Windows, Unix, or Linux) or command+c (Apple OS),
2. If the text is in the Command Window (this method does not work in the Editor Window),
with the mouse or touchpad, click right and select Copy.
(2) Pasting
a. Click left with the mouse or touchpad at the desired insertion point.
b. On the keyboard, hit Control+v (Microsoft Windows, Unix, or Linux) or Command+v (Apple OS).

Command window overflow

If commands overflow the visible portion of the Command Window so that some are hidden below the
bottom of the Command Window, a scrollbar at the right will allow them to be moved into view.
Current Folder

The current folder is the folder in which MATLAB commands operate. It is also the place from which files
can be downloaded and into which files can be uploaded. To define a folder to be the current folder,
double-click its name. See also Navigate.

Delete a file or folder

Before you delete a file or folder, note that MATLAB Online does not put it in a trash folder, so anything
you delete is permanently deleted.

Only one object (file or folder) can be deleted at a time. Here is how to permanently delete an object.

(1) Click right on the object name


(2) Click “Delete”
(3) A pop-up appears that says, “Are you sure you want to permanently delete this file or folder?”, and
gives the name of the file or folder”.
(4) Click Yes (hitting Enter or clicking the small “x” in the corner are each equivalent to selecting “No”).

Download (copy) files from the MATLAB cloud to your computer

(1) To download one file:


a. In the Current Folder Window, click the name of the file to be downloaded.
b. If the Home Ribbon is not on top, click the Home Tab. Then click the Download button with the
green down-arrow near the left of the Home Ribbon.
c. A file-navigation window will open up in the operating system of your local computer.
d. Navigate to the folder in which you wish to save the file.
e. Click Save.
(2) To download more than one file, it’s necessary to combine those files into one zip file. That
combining of files can be done with a MATLAB command as follows:
a. Create a new folder in your MATLAB-Online file space to contain the files to download.
b. Move or copy those files into that folder.
c. Make that new folder your current folder by double-clicking it.
d. Make a zip file named “foo” (or you can use a different name), containing all the files in that
folder by running the MATLA command: zip('foo','*').
e. Click on the new zip file in the current folder.
f. Click on Download from the Home tab to download the zip-file to your local computer.

Find & Replace

The Find & Replace window does not have a wrap-around option. This option allows the user to search
for the “next” occurrence of a word in a file from the current position forward to the end and then
“wrap around” to the beginning of the file to continue the search forward to the current point. MATLAB
Online does not support this feature, but it can be accomplished by conducting two searches.
Help

There are several ways to get help from MATLAB itself. NOTE: All but the first method produce a pop-up
window in your browser. If nothing pops up, try turning off the pop-up blocker in the browser that you
are using for the site matlab.mathworks.com (ie, make matlab.mathworks.com an exception to pop-up
blocking):

(1) The help command works in the same way in the Command Window as for installed MATLAB, but it
may take several seconds longer to display the requested help page, so be prepared to wait as much
as 10 seconds for it to respond.
(2) The Search box at the top right works in the same way as for installed MATLAB. Just type the name
of a topic or a command and hit Enter on the keyboard. A “MATLAB Online Documentation” window
will pop up with clickable links to subpages of interest. When you are done with that window, click
the faint x at the upper right corner.
(3) Clicking the question mark near the middle of the Home ribbon or clicking the word “Help” below it
and selecting “Documentation” brings up the same MATLAB Online Documentation window as the
Search box.
(4) Open new tab in your browser and point it at MATLAB Central:
http://www.mathworks.com/matlabcentral/ . Alternatively, open the Search window as above, and
then click the very tiny upward triangle at the upper left corner, which will open up MATLAB Central
in a new tab. At MATLAB Central you will find another search window and options for exchanging
information with the worldwide community of MATLAB users.

Indenting of code in the Editor Window

MATLAB Online uses automatic indenting of code in the Editor Window that is different from the
indenting that can be seen in the videos. However, this difference is purely cosmetic. It has no effect on
the execution of the code.

Load a file from the web into your MATLAB file space:

Use the command websave(filename,url), where url is the link to the file on the web.

For example, websave('z_mid.m','http://cs103.net/wp-content/uploads/zero_middle.m')


copies the file whose url is http://cs103.net/wp-content/uploads/zero_middle.m,
into the file named “z_mid.m” and places it into the Current Folder.

Log in to MATLAB Online

To log into MATLAB Online you must have a license.

(1) To obtain a license follow the steps given under Resources/Getting MATLAB Online.
(2) Once you have a license, do as follows:
a. Point your browser at https://matlab.mathworks.com. It is recommended that you use
Chrome, but Firefox, Safari, and Internet Explorer will work too. However Internet Explorer 8 or
earlier may not work.
b. Enter the email you used to obtain your license.
c. Enter the password you defined for your license.
d. Click Log In.
Log out of MATLAB Online

There are multiple ways to log out of MATLAB Online:

(1) Type the command quit in the Command Window at the command prompt.
(2) Click your name at the right of the window, just above the ribbon and to the left of the “Search
Documentation” window.
(3) Suppose you are already logged in to MATLAB Online on another computer or browser window, or
you just closed your browser without logging out. Then, if you try to log in on another computer or
another browser or browser tab, a pop-up will appear saying, “Existing MATLAB Session: You already
have an active MATLAB session. Do you want to log out of the active session and start a new
session?” Click OK and you will be logged out of the previous session and logged in to a new one.

Look inside a folder

In the Current Folder window, click the tiny triangle to the left of any visible folder name. The contents
of the folder will appear below it.

Move a file or folder

Only one file or folder can be moved at a time within your MATLAB Online file space. To move a file or
folder from one place to another:

(1) With the mouse or touchpad, highlight the name of the object (file or folder) to be moved.
(2) Remove the file from this location by one of the following methods (the file will not be removed
until you have pasted it into a new location):
a. Click right and select “Cut”.
b. Hit Ctrl+x on the keyboard.
(3) Navigate to the folder into which you wish to move the object and hit Ctrl+v on the keyboard. The
object will appear.

Navigate

Navigating is selecting a new folder to be the Current Folder. There are two choices:

(1) Move up one step: Select the parent of the Current Folder by single-clicking the tiny folder icon with
the black up arrow at the left of the Current Folder.
(2) Move down one or more steps: Double-click any folder that is visible in the Current Folder window.

New folder creation

(1) Navigate to the folder where the new folder is to be placed and double-click it to make it the
Current folder.
(2) Click the yellow plus-sign labeled, “New”, near the left of the Home tab.
(3) Click “Folder”.
(4) In the pop-up window, type the desired name of the new folder and Click OK or hit Enter.

Paste

See Copy and Paste


Rename a file or folder

(1) Click right on the folder name.


(2) Click “Rename” from the pop-down.
(3) Type in the new name.
(4) Hit Enter.

Saving a file in the Editor Window

To manually save a file that is open in the Editor Window, click the blue Save icon near the left of the
Editor ribbon.

Unlike recent installed versions of MATLAB, there is no option available in MATLAB Online to
automatically save a file that has been changed in the Editor Window every time the user clicks outside
the editor. Instead, an automatic save is performed every 30 to 60 seconds. Before running the file in
the command window, the user should habitually check the Save icon. If it is blue, then the version of
the file that is stored (and will be run) is out of date relative to the one visible in the Editor Window.

Startup/finish

MATLAB Online does not support the automatic calling of a startup m-file upon logging in and the calling
of a finish m-file upon logging out.

Stop a command that is running too long:

At the bottom right of the desktop click the button with the little red button labeled “Stop”. This red
square appears only after a command runs for more than about two seconds.

NOTE 1: Ctrl+c does not work with MATLAB Online.

NOTE 2: If the command that is being stopped is printing very many lines to the Command Window,
then they may overflow the Window (see Command Window overflow). Ordinarily the scroll bar at the
right can be used to bring them into view, but if a very large number of lines (thousands) has been
produced by the command, then the scroll bar will not work properly, and many seconds may elapse
after the red Stop button has been clicked before the command prompt reappears. The user must
simply wait for it.

Upload (copy) files from your computer to your MATLAB Online files:

(1) Click the Home tab at the left of the toolstrip near the top of the desktop to bring it in front of the
other tabs, if it is not already.
(2) Click the Upload button (with the green up-arrow) near the left of the HOME ribbon. A small
window labeled “Upload Files” will appear in the middle of the desktop.
(3) Click “Choose files”. A navigation window into the files on your computer will appear. You can use it
to navigate to the files you wish to upload.
(4) Click on the first file to copy. It will be highlighted. If you want to copy multiple files, Hold Control,
Ctrl, or Command (depending on your computer) while clicking additional files.
(5) Click “Choose” at the bottom left of that window. The navigation window will disappear.
(6) Click the “Upload” button in the Upload-Files window. A copy of the file will appear in the current
folder with the same name that it has on your computer (the file on your computer will remain
unchanged).
(7) Click OK in the Upload-Files window.

Вам также может понравиться