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

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

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

For these and other5-6MATLAB Workspaceforms of the function, see the reference page for save. MATLAB providesadditional functions for saving information – see Chapter 6, “Importing andExporting Data.”Loading a Saved WorkspaceTo load a workspace that you previously saved:1 Click the load data buttonon the toolbar in the Workspace browser, orright-click in the Workspace browser and select Import Data from thecontext menu.The Open dialog box opens.2 Select the MAT-file you want to load and click Open.The variables and their values, as stored in the MAT-file, are loaded into theworkspace.You can also load a saved workspace using the Import Wizard.

Select ImportData from the File menu and then select a file from the Import dialog box. TheImport Wizard opens. Use the Import Wizard to open the saved workspace. Forinstructions, see “Using the Import Wizard with Binary Data Files” onpage 6-20.Function Alternative. Use load to open a saved workspace. For example,load('june10')loads all workspace variables from the file june10.mat.Note If the saved MAT-file june10 contains the variables A, B, and C, thenloading june10 places the variables A, B, and C back into the workspace.

If thevariables already exist in the workspace, they are overwritten with thevariables from june10. For more information, see the reference page for load.MATLAB provides other functions for loading information – see Chapter 6,“Importing and Exporting Data.”5-75Workspace, Search Path, and File OperationsClearing Workspace VariablesYou can delete a variable, which removes it from the workspace.To clear a variable using the Workspace browser:1 In the Workspace browser, select the variable, or Shift+click or Ctrl+click toselect multiple variables. To select all variables, choose Select All from theEdit or context menus.2 Do one of the following to clear the selected variables:- Press the Delete key.- From the Edit menu, select Delete.- Click the delete buttonon the toolbar.- Right-click and select Delete Selection from the context menu.3 A confirmation dialog box may appear. If it does, click Yes to clear thevariables.The confirmation dialog box appears if you specify it as a preference.

See“Preferences for the Workspace Browser” on page 5-9 to change thepreference.To delete all variables at once, select Clear Workspace from the Edit menu, orfrom the context menu in the Workspace browser.Function Alternative. Use the clear function. For example,clear A Mclears the variables A and M from the workspace.Viewing Base and Function Workspaces Using the StackWhen you run M-files, MATLAB assigns each function its own workspace,called the function workspace, which is separate from MATLAB’s baseworkspace.

You can access the base and function workspaces when debuggingM-files by using the Stack field in the Workspace browser. The Stack field isonly available in debug mode; otherwise it is grayed out. The Stack field is alsoaccessible from the Editor/Debugger. See “Debugging M-Files” on page 7-17 formore information.5-8MATLAB WorkspaceCreating Graphics from the Workspace BrowserFrom the Workspace browser, you can generate a graph of a variable.Right-click on the variable you want to graph. From the context menu, selectGraph Selection and then choose the type of graph you want to create.

Thegraph appears in a figure window. For more information about creating graphsin MATLAB, see MATLAB graphics documentation.Preferences for the Workspace BrowserYou can specify as a preference the fonts to use in the Workspace browser andwhether or not you want a confirmation dialog box to appear when you clearvariables using the Workspace browser.From the Workspace browser File menu, select Preferences. The Preferencesdialog box opens to the Workspace Preferences panel.Font. Workspace browser font preferences specify the characteristics of the fontused in the Workspace browser. Select Use desktop font if you want the fontin the Workspace browser to be the same as that specified for General Font &Colors preferences.If you want the Workspace browser font to be different, select Use custom fontand specify the font characteristics for the Workspace browser:• Type, for example, SansSerif• Style, for example, bold• Size in points, for example, 12 pointsAfter you make a selection, the Sample area shows how the font will look.Confirm Deletion of Variables.

Check the box for Confirm deletion of variables ifyou want a confirmation dialog box to appear when you delete a variable.5-95Workspace, Search Path, and File OperationsViewing and Editing Workspace Variables Using theArray EditorUse the Array Editor to view and edit a visual representation of one ortwo-dimensional numeric arrays, strings, and cell arrays of strings. The ArrayEditor features are:• “Opening the Array Editor” on page 5-10• “Changing Values of Elements in the Array Editor” on page 5-12• “Controlling the Display of Values in the Array Editor” on page 5-12In addition, you can set preferences.

See “Preferences for the Array Editor” onpage 5-12.Opening the Array EditorYou can open the Array Editor from the Workspace browser:1 In the Workspace browser, select the variable you want to open. Shift+clickor Ctrl+click to select multiple2 variables to open.3 Click the open selection buttonon the toolbar, or right-click and selectOpen Selection from the context menu.Alternatively, for one variable, you can double-click it to open it.The Array Editor opens, displaying the values for the selected variable.You cannot open an array with 10,000 or more elements.5-10MATLAB WorkspaceChange values of array elements.Change the display format.Change the dimensions of the array.Use the tabs to view the different variables you have open in the Array Editor.Repeat the steps to open additional variables in the Array Editor.

Access eachvariable via its tab at the bottom of the window, or use the Window menu.Function Alternative. To see the contents of a variable in the workspace, just typethe variable name at the Command Window prompt. For example, typemand MATLAB returnsm =16594211714310615138121To open a variable in the Array Editor, use openvar with the name of thevariable you want to open as the argument. For example, typeopenvar('m')MATLAB opens m in the Array Editor.5-115Workspace, Search Path, and File OperationsChanging Values of Elements in the Array EditorIn the Array Editor, click in the cell whose value you want to change.

Type anew value. Press Enter or Return, or click in another cell and the change takeseffect.To change the dimensions of an array, type the new values for the rows andcolumns in the Size fields. If you increase the size, the new rows and columnsare added to the end and are filled with zeros. If you decrease the size, you willlose data – MATLAB removes rows and columns from the end. Some data typesdo not allow you to change the dimension; for these variables, the Size field isnot editable.If you opened an existing MAT-file and made changes to it using the ArrayEditor, you’ll have to save that MAT-file if you want the changes to be saved.For instructions, see “Saving the Current Workspace” on page 5-5.Controlling the Display of Values in the Array EditorIn the Array Editor, select an entry in the Numeric format list box to controlhow numeric values are displayed.

For descriptions of the formats, see thereference page for format. The format applies only to the Array Editor displayfor that variable for the current session; it does not affect how MATLABcomputes or saves the numeric value, nor does it affect the format used fordisplay in the Command Window.To specify a format for all variables in the Array Editor and keep it persistentacross sessions, specify the format for the Array Editor using preferences asdiscussed in the next topic.Preferences for the Array EditorUsing preferences for the Array Editor, you can specify the format for hownumeric values are displayed, as well as their font type, style, and size.To set preferences for the Array Editor, select Preferences from the Filemenu. The Preferences dialog box opens showing Array Editor Preferences.Specify the Font and Default format preferences.5-12MATLAB WorkspaceFont. Array Editor font preferences specify the characteristics of the font usedin the Array Editor.

Select Use desktop font if you want the font in the ArrayEditor to be the same as that specified for General Font & Colors preferences.If you want the Array Editor font to be different, select Use custom font andspecify the font characteristics for the Array Editor:• Type, for example, SansSerif• Style, for example, bold• Size in points, for example, 12 pointsAfter you make a selection, the Sample area shows how the font will look.Default Format.

Specify the output format of numeric values displayed in theArray Editor. This affects only how numbers are displayed, not how MATLABcomputes or saves them. For more information, see “Controlling the Display ofValues in the Array Editor” on page 5-12 or see the reference page for format.5-135Workspace, Search Path, and File OperationsSearch PathMATLAB uses a search path to find M-files and other MATLAB related files,which are organized in directories on your file system. These files anddirectories are provided with MATLAB and associated toolboxes.

Any file youwant to run in MATLAB must reside in a directory that is on the search pathor in the current directory. By default, the files supplied with MATLAB andMathWorks toolboxes are included in the search path.If you create any MATLAB related files, add the directories containing the filesto MATLAB’s search path. When you create your own M-files or if you modifyany MATLAB supplied M-files, save them in a directory that is not in$matlabroot/toolbox/matlab. If you do keep any of your files in$matlabroot/toolbox/matlab, they may be overwritten when you install anew version of MATLAB.

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

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

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

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