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

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

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

If youwant the font for Editor/Debugger files to be different, select Use custom fontand specify the font characteristics:• Type, for example, Lucida Console• Style, for example, Plain• Size in points, for example, 12 pointsAfter you make a selection, the Sample area shows how the font will look.You can specify different font characteristics for printing files from the Editor– see “Printing Preferences for the Editor/Debugger” on page 7-42.ColorsSpecify the colors used in files in the Editor/Debugger:• Text color – The color of nonspecial text; special text uses colors specified forSyntax highlighting.• Background color – The color of background in the window.• Syntax highlighting – The colors to use to highlight syntax. If checked, clickSet Colors to specify them.

For a description of syntax highlighting, see“Syntax Highlighting” on page 3-5.7-377Editing and Debugging M-FilesDisplay Preferences for the Editor/DebuggerUse Display preferences to specify how the Editor/Debugger window shouldlook.Opening files in editorThis preference controls how files are arranged when you open them in theEditor/Debugger.

When you change this preference, it applies to files you openafter making the change. Currently opened files are not rearranged to matchthe preference.Check Single window contains all files (tabbed style) to have a single Editor/Debugger window for all open files, as shown in the following illustration. Clickthe tab for a file to make it the current file.Files are tabbedwithin onewindow.7-38Preferences for the Editor/DebuggerCheck Each file is displayed in its own window to have a separate Editor/Debugger window for each open file, as shown in the following illustration.Each file isin its ownwindow.DisplayUse display options to specify what is shown and what is hidden in the Editor/Debugger.Show toolbar. Check this item to display the toolbar.

Uncheck it to hide thetoolbar.Show line numbers. Check this item to show line numbers. They appear along theleft side of the window. When you uncheck this item, line numbers aren’tshown.Enable datatips in edit mode. Check this item to see datatips while in edit mode.Datatips are always enabled in debug mode.7-397Editing and Debugging M-FilesPromptWhen you type edit filename and filename does not exist, MATLAB displaysa prompt asking if you want to create a new file named filename.m. If you donot want to see this prompt, uncheck the preference Show dialog promptwhen editing files that do not exist. Then, the next time you type editfilename, the file will be created without first prompting you.If you do not generally use the edit command to create new files, then youmight want to check the box to show the prompt. This alerts you to thepossibility that you mistyped the filename you want to open.Keyboard and Indenting Preferences for the Editor/DebuggerUse keyboard preferences to specify the key binding conventions MATLABshould follow.

Use indenting preferences to specify how the Editor/Debuggerindents lines.Key bindingsSelect Windows or Emacs depending on which convention you want theEditor/Debugger to follow for accelerators and shortcuts. The accelerators seenon the menus change after you change this option.For example, when you select Windows key bindings, the shortcut to paste aselection is Ctrl+V. When you select Emacs key bindings, the shortcut to pastea selection is Ctrl+Y. You can see the accelerator on the Edit menu for thePaste item.M-file indenting for Enter keySelect the style of indenting you want the Editor/Debugger to use when youpress the Enter key. Examples follow, illustrating the different styles.• No indent – No lines are indented.

Use this is you want lines to be alignedon the left or want to insert line indents manually.• Block indent – Indents a line the same amount as the line above it.• Smart indent – Automatically indents lines that start with keywordfunctions or that follow certain keyword functions. Smart indenting can helpyou to follow the code sequence.7-40Preferences for the Editor/DebuggerThe indenting style only applies to lines you enter after changing thepreference; it does not affect the indenting of existing lines. To change theindenting for existing lines, use the Text menu entries for “Indenting” onpage 7-9.For any indenting style, you can manually insert tabs at the start of a line.Example of No Indent Without Tabs.Created using No indent preference.Did not manually insert any tabs.Example of No Indent with Tabs.Created using No indent preference.Created indentation by manually inserting a tabbefore each indented line.Example of Block Indent.Created using Block indent preference.Inserted a tab before the if statement.Subsequent lines automatically indented one tab.7-417Editing and Debugging M-FilesExample of Smart Indent.Created using Smart indent preference.Did not manually insert any tabs.Indented lines were automatically indented.IndentIndent size.

Specify the indent size for smart indenting.Emacs-style tab key smart indenting. This indenting convention is based on thestyle used by the Emacs editor. When you select the style, lines are notautomatically indented. To indent a line(s) according to smart indentingpractices, you can position the cursor in that line or select a group of lines andthen press the Tab key.TabTab size. Specify the amount of space inserted when you press the Tab key.When you change the Tab size, it changes the tab space for existing lines inthat file.Tab key inserts spaces. Check this item if you want a series of spaces to beinserted when you press the Tab key.

If the item is unchecked, a tab acts as onespace whose length is determined by Tab size.Printing Preferences for the Editor/DebuggerUse printing preferences to specify how printed M-files will look.Syntax higlightingThis preference specifies how highlighted syntax is printed. The options are:• Print as black and white text• Print as colored text• Print as styled text – Prints in black and white.

Comments are italicizedand keywords are bold.7-42Preferences for the Editor/DebuggerPrint options• Check Print header to include a header on the printed page that lists thefull pathname for the file, page numbers, and the date and time it is printed.• Check Print line numbers to include line numbers when printing files.FontUse this preference to specify font characteristics for printed M-files. This isespecially useful on Windows platforms because a given font size is displayedslightly smaller than the actual size, but is printed at the actual size.

Thereforethe font in the printed output might look larger than you expected.To print documents using the same font characteristics as specified for theEditor/Debugger (see “Font & Colors Preferences for the Editor/Debugger” onpage 7-37), select Use editor font.To print documents with different font characteristics than those specified forthe Editor/Debugger, select Use custom font. After selecting this option,specify the font characteristics:• Type, for example, Lucida Console• Style, for example, Plain• Size in points, for example, 12 points7-437Editing and Debugging M-Files7-448Improving M-FilePerformance – the ProfilerWhat Is Profiling?.

. . . . . . . . . . . . . . . . 8-3Using the Profiler . . . . . . . . . . . . . . . . . 8-4The profile Function . . . . . . . . . . . . . . . . . 8-4An Example Using the Profiler . . . . . . . . . . . . . 8-6Viewing Profiler ResultsViewing Profile Reports . .Profile Plot . . . . . . .Saving Profile Reports . ...................................................... 8-7. 8-7. 8-12. 8-138Improving M-File Performance – the ProfilerOne way to improve the performance of your M-files is to profile them.MATLAB provides an M-file profiler that lets you see how much computationtime each line of an M-file uses.This section on profiling covers the following topics:• “What Is Profiling?” on page 8-3• “Using the Profiler” on page 8-4, including “The profile Function” and “AnExample Using the Profiler”• “Viewing Profiler Results” on page 8-7There are numerous other techniques for improving the performance of yourM-files.

For a list of these types of functions, see Performance Tools andTechniques.8-2What Is Profiling?What Is Profiling?Profiling is a way to measure where a program spends its time. Measuring is amuch better method than guessing where the most execution time is spent. Youprobably deal with obvious speed issues at design time and can then discoverunanticipated effects through measurement. One key to effective coding is tocreate an original implementation that is as simple as possible and then use aprofiler to identify bottlenecks if speed is an issue. Premature optimizationoften increases code complexity unnecessarily without providing a real gain inperformance.Use the profiler to identify functions that are consuming the most time, thendetermine why you are calling them and look for ways to minimize their use.

Itis often helpful to decide whether the number of times a particular function iscalled is reasonable. Because programs often have several layers, your codemay not explicitly call the most expensive functions. Rather, functions withinyour code may be calling other time-consuming functions that can be severallayers down in the code.

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

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

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

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