Using MATLAB (779505), страница 10

Файл №779505 Using MATLAB (Using MATLAB) 10 страницаUsing MATLAB (779505) страница 102017-12-27СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 10)

If you are not amember, you can join online to help you keep up-to-date on the latestMATLAB developments.2-20Setting PreferencesSetting PreferencesSet preferences to modify the default behavior of some aspects of MATLABsuch as the font used in the Command Window. Preferences remain persistentacross MATLAB sessions. Note that some tools allow you to control theseaspects from within the tool without setting a preference – use that method ifyou only want the change to apply to the current session.To set preferences:1 Select Preferences from the File menu.The Preferences dialog box opens.

The page it opens to reflects thecurrently active window.2-212Using the Desktop2 In the left pane, select the type of preferences you want to specify. In theabove example, General preferences are selected.If a + appears to the left of an item, click the + to display more items, andthen select the item you want to set preferences for.The right pane reflects the type of preference you selected.3 In the right pane, specify the preference values and click OK.The preferences take effect immediately.2-22Type of Preference andWhere DescribedItems You Can Set Preferences For“General Preferences forMATLAB” on page 2-23For desktop display, caching, printing, fonts,colors, and source control system“Preferences for theCommand Window” onpage 3-13Numeric format and display, echo, font, andcolors“Preferences for theEditor/Debugger” onpage 7-35Startup options, font, colors, display, keyboardshortcuts, indenting, and printing“PrintingDocumentation” onpage 4-26Documentation location, products, PDF readerlocation, synchronization, and fonts“Preferences for theCurrent DirectoryBrowser” on page 5-30Number of entries in history and file displayoptions“Preferences for theWorkspace Browser” onpage 5-9Font and confirm deletion of variables“Preferences for theArray Editor” onpage 5-12Font and numeric formatSetting PreferencesType of Preference andWhere DescribedItems You Can Set Preferences For (Continued)GUIDEDisplay optionsFigure Copy TemplateApplication, text, line, uicontrols, axis, format,background color, and sizeSimulinkDisplay, fonts, and simulation.The preferences file is matlab.prf.

Type prefdir in the Command Window tosee the location of the file. The matlab.prf file is loaded when MATLAB startsand overwritten when you close MATLAB.General Preferences for MATLABThese preferences apply to all relevant tools in the MATLAB desktop.DisplayTo show tooltips when you hold the cursor over a toolbar button, check theShow tooltips check box.Toolbox cachingSee “Reducing Startup Time with Toolbox Path Caching” on page 1-10.Figure window printingSpecify how colored lines and text are sent to the printer.

See the Printingdocumentation for more information.Font & ColorsDesktop font. Desktop font preferences specify the characteristics of the fontused in tools under the control of the MATLAB desktop. The fontcharacteristics are:• Type, for example, SansSerif• Style, for example, bold• Size in points, for example, 12 points2-232Using the DesktopAfter you make a selection, the Sample area shows how the font will look.Lucida Console approximates the fixedsys font available in previous versionsof MATLAB.You can specify a different font for the Command Window, Editor/Debugger,Help browser, Workspace browser, and Array Editor using preferences forthose tools.Syntax highlighting colors.

Select the colors to use to highlight syntax. For moreinformation, see “Syntax Highlighting” on page 3-5.• Keywords – Flow control and other functions such as for and if are colored.• Comments – All lines beginning with a % are colored.• Strings – Single quotes and whatever is between them are colored.• Unterminated strings – A single quote without a matching single quote,and whatever follows or precedes the quote are colored.• System commands – Commands such as the ! (shell escape) are colored.• Errors – The error text is colored.Click Restore Default Colors to return to the default settings.

The followingexample uses the default values for color preferences.Keywords, likethese flow controlcommands are blue.Closed strings are maroon.Unclosed strings arepurple.Source ControlSpecify the source control system you want to interface MATLAB to. For moreinformation, see Chapter 9, “Interfacing with Source Control Systems.”2-243Running MATLABFunctionsThe Command Window . .

. . . . .Opening the Command Window . . . .Running Functions and Entering VariablesControlling Input and Output . . . . .Running Programs . . . . . . . . . .Keeping a Session Log . . . . . . . .Preferences for the Command Window . ................................................... 3-2. 3-2. 3-2.

3-4. 3-11. 3-12. 3-13Command History . . . . . . . . . . . . . . .Viewing Functions in the Command History Window . .Running Functions from the Command History WindowCopying Functions from the Command History Window ...... 3-17. 3-17. 3-18. 3-193Running MATLAB FunctionsThe Command WindowThe Command Window is the main way you communicate with MATLAB. Itappears in the desktop when you first start MATLAB. Use the CommandWindow to run MATLAB functions (also referred to as commands) and performMATLAB operations. The main features of the Command Window are:• “Opening the Command Window” on page 3-2• “Running Functions and Entering Variables” on page 3-2• “Controlling Input and Output” on page 3-4, such as suppressing output andcommand line editing• “Running Programs” on page 3-11, including M-files and external programs• “Keeping a Session Log” on page 3-12• “Preferences for the Command Window” on page 3-13Opening the Command WindowTo show the Command Window in the MATLAB Desktop, select CommandWindow from the View menu – see “Opening and Closing Desktop Tools” onpage 2-7 for details.Running Functions and Entering VariablesThe prompt (>>) in the Command Window indicates that MATLAB is ready toaccept input from you.

When you see the >> prompt, you can enter a variableor run a function. For example, to create A, a 3-by-3 matrix, typeA = [1 2 3; 4 5 6; 7 8 10]3-2The Command WindowWhen you press the Enter or Return key after typing the line, MATLABresponds withA =1472583610To run a function, type the function including all arguments and press Returnor Enter. MATLAB displays the result.

For example, typemagic(2)and MATLAB returnsans =1432If you want to enter multiple lines before running, use Shift+Enter orShift+Return after each line until the last. Then press Enter or Return to runall of the lines.The K>> prompt in the Command Window indicates that MATLAB is in debugmode. For more information, see Chapter 7, “Editing and Debugging M-Files.”Evaluating a SelectionTo run a selection in the Command Window, make the selection, and thenright-click and select Evaluate Selection from the context menu. You cannotevaluate a selection while MATLAB is busy, for example, running an M-file.Opening a SelectionTo open the M-file for a function, select that function in the Command Window,and then right-click and select Open Selection from the context window.

TheM-file for that function opens in the Editor/Debugger.Running One ProcessYou can only run one process at a time. If MATLAB is busy running onefunction, any commands you issue will be stacked. The next command will runwhen the previous one finishes. For example, you cannot set breakpoints from3-33Running MATLAB Functionsthe Editor/Debugger while MATLAB is running a function in the CommandWindow.Controlling Input and OutputYou can control and interpret input and output in the Command Window inthese ways:• “Case and Space Sensitivity” on page 3-4• “Entering Multiple Functions in a Line” on page 3-4• “Entering Long Lines” on page 3-5• “Syntax Highlighting” on page 3-5• “Font Used in the Command Window” on page 3-6• “Command Line Editing” on page 3-6• “Clearing the Command Window” on page 3-9• “Suppressing Output” on page 3-9• “Paging of Output in the Command Window” on page 3-10• “Controlling the Format and Spacing of Numeric Output” on page 3-10• “Printing Command Window Contents” on page 3-11Case and Space SensitivityMATLAB is case sensitive.

For example, you cannot run the function Plot butmust instead use plot. Similarly, the variable a is not the same as the variableA. Note that if you use the help function, function names are shown in alluppercase, for example, PLOT, solely to distinguish them. Do not use uppercasewhen running the functions. Some functions for interfacing to Java actuallyused mixed case and the M-file help accurately reflects that.Blank spaces around operators such as -, :, and ( ), are optional, but theyimprove readability.Entering Multiple Functions in a LineTo enter multiple functions on a single line, separate the functions with acomma ( , ) or semicolon ( ; ). Using the semicolon instead of the comma willsuppress the output for the command preceding it.

For example, put threefunctions on one line to build a table of logarithms by typingformat short; x = (1:10)'; logs = [x log10(x)]3-4The Command Windowand then press Enter or Return to run the functions in left-to-right order.Entering Long LinesIf a statement does not fit on one line, use an ellipsis (three periods, ...) toindicate that the statement continues on the next line, press Enter or Returnto advance to the next line, and then continue entering the statement.

Forexample,s = 1 – 1/2 + 1/3 – 1/4 + 1/5 – 1/6 + 1/7 ...– 1/8 + 1/9 – 1/10 + 1/11 – 1/12;For items in single quotes, such as strings, put the quotes in each line. Forexample, entering the following long stringheaders = ['Author Last Name, Author First Name, ’ ...'Author Middle Initial’]results inheaders =Author Last Name, Author First Name, Author Middle InitialThe maximum number of characters allowed on a single line is 4096.Syntax HighlightingSome entries appear in different colors to help you better find elements, suchas matching if/else statements:• Type a string and it is colored purple.

When you close the string, it becomesmaroon.• Type a keyword, such as the flow control function for, or a continuation(ellipsis ...), and it is colored blue. Lines you enter between the opening andclosing flow control functions are indented.• Double-click an opening or closing token, a parenthesis ( ), bracket [ ], orbrace { }. This selects the characters between the token and its mate.• Type a closing (or opening) token and the matching opening (or closing)token is highlighted briefly.• Type a mismatched closing (or opening) token and a strikethrough characterappears on the token.

For example3-53Running MATLAB Functions• Use an arrow key to move over an opening or closing token. That token andits matching closing or opening token briefly appear underlined.• Type a comment symbol, %, and what follows on the line appears in green.That information is treated by MATLAB as a comment.• Type a system command, such as the ! (shell escape), and the line appearsin gold.• Errors appear in red.Default colors are shown here – to change them, use Preferences.Keywords, likethese flow controlcommands are blue.Closed strings are maroon.Unclosed strings arepurple.To change the colors used for syntax highlighting, see “Font & ColorsPreferences for the Command Window” on page 3-15.Font Used in the Command WindowYou can specify the font type, style, and size used in the Command Window.For instructions, see “Font & Colors Preferences for the Command Window” onpage 3-15.Command Line EditingThese are time-saving features you can use in the Command Window:• Clipboard features• Recalling previous lines• Tab completion3-6The Command WindowClipboard Features.

Характеристики

Тип файла
PDF-файл
Размер
6,57 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6997
Авторов
на СтудИзбе
262
Средний доход
с одного платного файла
Обучение Подробнее
{user_main_secret_data}