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

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

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

Use which to display the pathname for the specified function. Useexist to see if a directory or file exists.5-22File OperationsAdding Directories to the MATLAB Search PathFrom the Current Directory browser, you can add directories to the MATLABsearch path. Right-click and from the context menu, select Add to Path. Thenselect one of the options:• Current Directory – Adds the current directory to the path.• Selected Folders – Adds the directory selected in the Current Directorybrowser to the path.• Selected Folder and Subfolders – Adds the directory selected in theCurrent Directory browser to the path, and adds all of its subdirectories tothe path.Changing the DisplayTo specify the types of files shown in the Current Directory browser, useView -> Current Directory Filter.

For example, you can show only M-files.You can sort the information shown in the Current Directory browser bycolumn. Click the title of column on which you want to sort. The display issorted, with the information in the that column shown in ascending order.Click a second time on the column title to sort the information in descendingorder.If you make changes to the current directory from your file system, the CurrentDirectory browser display won’t immediately reflect those changes. SelectRefresh from the context menu to update the Current Directory browserdisplay.Creating, Renaming, Copying, and RemovingDirectories and FilesIf you have write permission, you can create, copy, remove, and renameMATLAB related files and directories for the directory shown in the CurrentDirectory browser.

If you do not have write permission, you can still copy filesand directories to another directory.5-235Workspace, Search Path, and File OperationsCreating New FilesTo create a new file in the current directory:1 Select New from the context menu or File menu and then select the type offile to create.An icon for that file type, for example, an M-file icon, with the defaultname Untitled appears at the end of the list of files shown in the CurrentDirectory browser.2 Type over Untitled with the name you want to give to the new file.3 Press the Enter or Return key.The file is added.4 To enter the contents of the new M-file, open the file – see “Opening,Running, and Viewing the Content of Files” on page 5-26.

If you created thefile using the context menu, the new file opens with a template for writingan M-file function.Create New DirectoriesTo create a new directory in the current directory:1 Click the new folder buttonin the Current Directory browser toolbar, orselect New -> Folder from context menu.An icon, with the default name NewFolder appears at the end of the list offiles shown in the Current Directory browser.2 Type over NewFolder with the name you want to give to the new directory.3 Press the Enter or Return key.The directory is added.Function Equivalent.

To create a directory, use the mkdir function. For example,mkdir ..\testdata newdircreates the directory newdir within the directory testdata.5-24File OperationsRenaming Files and DirectoriesTo rename a file or directory, select the item, right-click, and select Renamefrom the context menu. Type over the existing name with the new name for thefile or directory, and press the Enter or Return key. The file or directory isrenamed.Cutting or Deleting Files and DirectoriesTo cut or delete files and directories:1 Select the files and directories to remove. Use Shift+click or Ctrl+click toselect multiple items.2 Right-click and select Cut or Delete from the context menu. Cut is alsoavailable from the Edit menu.The files and directories are removed.Function Equivalent.

To delete a file, use the delete function. For example,delete('d:\mymfiles\testfun.m')deletes the file testfun.m.Copying and Pasting FilesYou can copy and paste files, but not directories. To copy and paste files:1 Select the files. Use Shift+click or Ctrl+click to select multiple items.2 Right-click and select Copy from the context menu, or select Copy from theEdit menu.3 Move to the directory where you want to paste the files you just copied or cut.4 Paste the files by right-clicking and selecting Paste from the context menu,or by selecting Paste from the Edit menu.5-255Workspace, Search Path, and File OperationsOpening, Running, and Viewing the Content of FilesOpening FilesYou can open a file using the open feature of the Current Directory browser.The file opens in the tool associated with that file type.To open a file, select one or more files and perform one of the following actions:• Press the Enter or Return key.• Right-click and select Open from the context menu.• Double-click on the file(s).The files open in the appropriate tools.

For example, the Editor/Debuggeropens for M-files, and Simulink opens for model (mdl) files.To open any file in the Editor, no matter what type it is, select Open as Textfrom the context menu.You can also import data from a file. Select the file, right-click, and selectImport Data from the context menu. The Import Wizard opens.

See Chapter6, “Importing and Exporting Data” for instructions to import the data.Function Alternative. Use the open function to open a file into the tool appropriatefor the file, given its file extension. Default behavior is provided for standardMATLAB file types. You can extend the interface to include other file types andto override the default behavior for the standard files.5-26File TypeExtensionActionFigure filefigOpen figure in a figure window.HTML filehtmlOpen HTML file name in the Help browser.M-filemOpen M-file name in the Editor.MAT-filematOpen MAT-file name in the Import Wizard.ModelmdlOpen model name in Simulink.P-filepOpen the corresponding M-file, name.m, if itexists, in the Editor.File OperationsFile TypeExtensionAction (Continued)VariablenotapplicableOpen the numeric or string array name in theArray Editor; open calls openvar.OthercustomOpen name.custom by calling the helperfunction opencustom, where opencustom is auser-defined function.To view the content of an ASCII file, such as an M-file, use the type function.For exampletype('startup')displays the contents of the file startup.m in the Command Window.Running M-FilesTo run an M-file from the Current Directory browser, select it, right-click, andselect Run from the context menu.

The results appear in the CommandWindow.Viewing Help for an M-FileYou can view help for the M-file selected in the Current Directory browser.From the context menu, select View Help. The reference page for that functionappears in the Help browser, or if a reference page does not exist, the M-filehelp appears.You can view the M-file help in the Current Directory browser – forinstructions, see “Preferences for the Current Directory Browser” on page 5-30.5-275Workspace, Search Path, and File OperationsFinding and Replacing Content Within FilesFrom the Current Directory browser, you can search for a specified stringwithin files.

If the file is open in the Editor, you can replace the specified stringin a file.Finding a Specified String Within a FileTo search for a specified string in files:1 Click the find buttonin the Current Directory browser toolbar.The Find & Replace dialog box appears. This provides the same features asthe Find & Replace dialog box accessible from the Editor/Debugger.2 Complete the Find & Replace dialog box to find all occurrences of the stringyou specify.- Type the string in the Find what field.- Select the directories to search through from the Look in listbox, or typea directory name directly in this field.- Constrain the search by checking Match case or Whole word.- Check the box for Subdirectories if you want the search to also lookthrough the subdirectories.5-28File Operations3 Click Find.Results appear in the lower part of the Find & Replace dialog box andinclude the filename, M-file line number, and content of that line.Close theresults section.Double-clickon a file in theresults list toopen it.The results ofprevious findoperations areavailable viatabs.4 Open any M-file(s) in the results list by doing one of the following:- Double-clicking the file(s)- Selecting the file(s) and pressing the Enter or Return key- Right-clicking the file(s) and selecting Open from the context menuThe M-file(s) opens in the Editor, scrolled to the line number shown in theresults section of the Find & Replace dialog box.5 If you perform another search, the results of each search are accessible viatabs just below the current results list.

Click a tab to see that results list aswell as the search criteria.5-295Workspace, Search Path, and File OperationsFunction Equivalent. Use lookfor to search for the specified string in the first lineof help in all M-files on the search path.Replacing a Specified String Within FilesAfter searching for a string within a file, you can replace the string.1 Open the file in MATLAB Editor. You can open the file from the CurrentDirectory browser Find & Replace dialog box results list – see step 4 in“Finding a Specified String Within a File” on page 5-28. Be sure that the filein which you want to replace the string is the current file in the Editor.2 In the Look in field in the Find & Replace dialog box, select the name of thefile in which you want to replace the string.The Replace button in the Find & Replace dialog box becomes selectable.3 In the Replace with field, type the text that is to replace the specified string.4 Click Replace to replace the string in the selected line, or click Replace Allto replace all instances in the currently open file.The text is replaced.5 To save the changes, select Save from the File menu in the Editor.Preferences for the Current Directory BrowserYou can specify the number of recently used current directories to maintain inthe history list as well as the type of information to display in the CurrentDirectory browser using preferences.5-30File OperationsFrom the Current Directory browser File menu, select Preferences.

TheCurrent Directory Preferences panel appears in the Preferences dialog box.HistoryThe drop down list in the Current Directory browser toolbar, as well as in theMATLAB desktop Current Directory field, show the most recently used currentdirectories. The list contains all of the current directories used in the currentMATLAB session.Removing Directories. To remove the entries in the list, select Clear History. Thelist is cleared immediately.Saving Directories. When the MATLAB session ends, the list of directories will bemaintained.

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

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

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

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