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

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

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

The M-fileopens in the MATLAB Editor. To open the Editor without a file, open$matlabroot/bin/win32/meditor.exe. Regardless of the type of MATLABlicense you have, you can open multiple instances of meditor because it is notconsidered an instance of MATLAB.When you open the MATLAB Editor without starting MATLAB, the Editor isa stand-alone application. You cannot debug M-files from it, evaluate aselection, access source control features, dock the Editor in the MATLABdesktop, nor access help from it. It remains a stand-alone application, even ifyou subsequently open MATLAB. Other than these limitations, you can use theediting features as described in “Creating and Editing M-Files with the Editor/Debugger” on page 7-8.For Windows platforms, when MATLAB is installed, the stand-alone Editor isautomatically associated with files having a .m extension. If you double-clickon an M-file, the stand-alone Editor opens.

You can change the associationusing Windows Explorer so that files with a .m extension will open in theEditor/Debugger in MATLAB.Closing the Editor/DebuggerTo close the Editor/Debugger, click the close box in the title bar of the Editor/Debugger. This is different from the close box in the toolbar of the Editor/7-6Starting the Editor/DebuggerDebugger, which closes the current file when multiple files are open in a singlewindow.Close box for Editor/DebuggerClose box for current fileWhen you close the current file and it is the only file open, then the Editor/Debugger closes as well.If multiple files are open with each in a separate Editor/Debugger window,close each window separately or close all of the files at once using the Close Allitem in the Window menu.When you close the Editor/Debugger and any of the open files have unsavedchanges, you will be prompted to save the files.7-77Editing and Debugging M-FilesCreating and Editing M-Files with the Editor/DebuggerAfter opening an existing file or creating a new file, enter text in the Editor/Debugger.

Follow the same rules you would use for entering text in theCommand Window as described in these sections:• “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• “Suppressing Output” on page 3-9• “Controlling the Format and Spacing of Numeric Output” on page 3-10Use the editing features described in these sections:• “Appearance of an M-File” on page 7-8, including syntax highlighting• “Navigating in an M-File” on page 7-11, including go to and find features• “Saving M-Files” on page 7-15• “Running M-Files from the Editor/Debugger” on page 7-15• “Printing an M-File” on page 7-16• “Closing M-Files” on page 7-16Appearance of an M-FileThe following features make M-files more readable:• “Syntax Highlighting” on page 7-8• “Indenting” on page 7-9• “Commenting” on page 7-9• “Showing Balanced Delimiters” on page 7-10You can specify the default behavior for many of them – see “Preferences forthe Editor/Debugger” on page 7-35.Syntax HighlightingSome entries appear in different colors to help you better find matchingelements, such as if/else statements.

For more information, see “SyntaxHighlighting” on page 3-5.7-8Creating and Editing M-Files with the Editor/DebuggerIndentingFlow control entries are automatically indented to aid in reading the loops,such as while/end statements.To move the current or selected lines further to the left, select DecreaseIndent from the Text menu. To move the current or selected lines further tothe right, select Increase Indent from the Text menu.

If after using thesefeatures you want to apply automatic indenting to selected lines, select SmartIndent from the Text menu, or right-click and select it from the context menu.For more information about smart indenting, see the preference for smartindent.CommentingYou can comment the current line or a selection of lines.

To select a line, clickjust to the left of the line – the line becomes highlighted. Drag or Shift+click toselect multiple lines. Then select Comment from the Text menu, or right-clickand select it from the context menu. A comment symbol, %, is added at the startof the line, and the color of the text becomes green.You can make any line a comment by typing a % at the beginning of it. To puta comment within a line, type % followed by the comment text; MATLAB treatsall the information after the % on that line as a comment.7-97Editing and Debugging M-FilesYou can also uncomment a selected group of lines – select Uncomment fromthe Text menu, or right-click and select it from the context menu.Click in the area to the left of a line to select that line.Drag or Shift+click to select multiple lines as shown here.Showing Balanced DelimitersWhen you position the cursor inside a pair of delimiters, that is, inside ( ), [ ],or { }, and select Balance Delimiters from the Text menu, the string inside thepair of delimiters is highlighted.

In this example, when the cursor is positionedbefore /norm, as indicated hereselecting Balance Delimiters highlights the selection as shown here.7-10Creating and Editing M-Files with the Editor/DebuggerNavigating in an M-FileThere are several options for navigating in M-files:• “Going to a Line Number”• “Going to a Bookmark”• “Going to a Function”• “Finding a Selection”• “Finding and Replacing a String”Going to a Line NumberLine numbers are displayed along the left side of the Editor/Debugger window.Select Go to Line from the Edit menu.

Enter the line number in the edit boxand click OK. The cursor moves to that line number in the current M-file.Going to a BookmarkYou can set a bookmark at a line in an M-file so you can quickly go to thebookmarked line. This is particularly useful in long M-files. For example, ifyou’re working on a line but need to look at another part of the file, set abookmark at the current line, go to the other part of the file, and then go backto the bookmark.To set a bookmark, position the cursor anywhere in the line and select SetBookmark from the Edit menu. A bookmark icon appears to the left of the line.To go to a bookmark, select Next Bookmark or Previous Bookmark from theEdit menu.To clear a bookmark, position the cursor anywhere in the line and select ClearBookmark from the Edit menu.Bookmarks are not saved when you close a file.Going to a FunctionTo go to a function in an M-file (referred to as a subfunction), click the functionbuttonon the toolbar.

Select the function you want to go to from the list ofall functions in that M-file. The list does not include functions that are calledfrom the M-file, but only lists lines in the current M-file that begin with afunction statement.7-117Editing and Debugging M-FilesFinding a SelectionWithin the current M-file, select a string. From the Edit menu, select FindSelection. The next occurrence of that string becomes highlighted. Use FindSelection from the Edit menu to continue finding the next occurrences of thestring.To find the previous occurrence of the selected string (find backwards), pressCtrl+Shift+F3.Finding and Replacing a StringYou can search for a specified string within multiple files, and replace thestring within a file.Finding a String. To search for a string in files:1 Click the find buttonin the Editor/Debugger toolbar, or select Find andReplace from the Edit menu.The Find & Replace dialog box appears.

This provides the same features asthe Find & Replace dialog box accessible from the Current Directorybrowser.2 Complete the Find & Replace dialog box to find all occurrences of the stringyou specify.a Type the string in the Find what field.b Select the files to search through from the Look in listbox.c7-12Limit the search using Match case, Whole word, or Wrap around.These settings are remembered for your next MATLAB session.Creating and Editing M-Files with the Editor/Debugger3 Click Find.- If you search for the current file, the next occurrence of the string ishighlighted in the file.- If the search is through multiple files, results appear in the lower part ofthe Find & Replace dialog box and include the filename, M-file linenumber, and content of that line.Close theresults section.Double-clickon a file in theresults list toopen it.The results ofprevious findoperations areavailable viatabs.7-137Editing and Debugging M-Files4 Open any M-file(s) in the results list by doing one of the following:- Double-clicking it.- Selecting it and pressing the Enter or Return key.- Right-clicking it and selecting Open from the context menu.The M-file opens, scrolled to the line number shown in the results section ofthe Find & Replace dialog box.5 If you perform another search, the results of each search are accessible viatabs just below the results list.

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

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

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

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