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

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

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

Use the Save most recent directories field to specify how manydirectories will appear on the list in at the start of the next MATLAB session.Browser display optionsIn the Current Directory browser, you can view the file type, last modified date,M-file descriptions, and M-file comments and MAT-file contents by checkingthe appropriate Browser display options.5-315Workspace, Search Path, and File Operations5-326Importing and ExportingDataImporting Text Data. .

. . . . . . . . . . . . . 6-4Exporting ASCII Data . . . . . . . . . . . . . . . . 6-16Importing Binary Data . . . . . . . . . . . . . . . 6-20Exporting Binary Data . . . . . . . . . . . . . . . 6-25Working with HDF Data. . . . . . . . . . . . . . 6-29Using Low-Level File I/O Functions.

. . . . . . . . 6-516Importing and Exporting DataMATLAB provides many ways to load data from disk files or the clipboard intothe workspace, a process called importing data, and to save workspacevariables to a disk file, a process called exporting data. Your choice of whichmechanism to use depends on which operation you are performing, importingor exporting, and the format of the data, text or binary.Note The easiest way to import data into MATLAB is to use the ImportWizard.

When you use the Import Wizard, you do not need to know the formatof the data. You simply specify the file that contains the data and the ImportWizard processes the file contents automatically. For more information, see“Using the Import Wizard with Text Data” on page 6-4 and “Using the ImportWizard with Binary Data Files” on page 6-20.Text DataIn text formats, the data values are American Standard Code for InformationInterchange (ASCII) codes that represent alphabetic and numeric characters.ASCII text data can be viewed in a text editor. For more information aboutworking with text data, see:• “Importing Text Data” on page 6-4• “Exporting ASCII Data” on page 6-16Binary DataIn binary format, the values are not ASCII codes and cannot be viewed in a texteditor.

Binary files contain data that represents images, sounds, and otherformats. For more information about working with binary data, see:• “Importing Binary Data” on page 6-20• “Exporting Binary Data” on page 6-25Other FormatsMATLAB also supports the importing of scientific data that uses theHierarchical Data Format (HDF). See “Working with HDF Data” on page 6-29for more information.6-2Low-Level File I/OMATLAB also supports C-style, low-level I/O functions that you can use withany data format.

For more information, see “Using Low-Level File I/OFunctions” on page 6-51.6-36Importing and Exporting DataImporting Text DataThe easiest way to import text data into the workspace is to use the MATLABImport Wizard. You simply start the Import Wizard and specify the file thatcontains the data you want to import.

The Import Wizard can process mostnumeric data files automatically, even if they contain text headers. See “Usingthe Import Wizard with Text Data” below for more detailed information.If you need to work from the MATLAB command line or perform importoperations as part of an M-file, you must use one of the MATLAB importfunctions. Your choice of which function to use depends on the type of data inthe file and how the data is formatted.

MATLAB has functions that work withnumeric data and other functions that can handle both alphabetic and numericdata. See “Using Import Functions with Text Data” on page 6-9 for moreinformation about choosing the function that is right for your data.Caution When you import data into the MATLAB workspace, you overwriteany existing variable in the workspace with the same name.Using the Import Wizard with Text DataTo import text data using the Import Wizard, perform these steps:1 Start the Import Wizard, by selecting the Import Data option on theMATLAB File menu.

MATLAB displays a file selection dialog box. You canalso use the uiimport function to start the Import Wizard.To use the Import Wizard to import data from the clipboard, select the PasteSpecial option on the MATLAB Edit menu. You can also right-click in theMATLAB command window and choose Paste Special from the contextmenu. Skip to step 3 to continue importing from the clipboard.2 Specify the file you want to import in the file selection dialog box and clickOpen. The Import Wizard opens the file and attempts to process itscontents.3 Specify the character used to separate the individual data items.

Thischaracter is called the delimiter or column-separator. The Import Wizard6-4Importing Text Datacan determine the delimiter used in many cases. However, you may need tospecify the character used in your text file. See “Specifying the Delimiter” onpage 6-5 for more information. Once the Import Wizard has correctlyprocessed the data, click Next.4 Select the variables that you want to import. By default, the Import Wizardputs all the numeric data in one variable and all the text data in othervariables but you can choose other options.

See “Selecting the Variables toImport” on page 6-7 for more information.5 Click Finish to import the data into the workspace.Specifying the DelimiterWhen the Import Wizard opens a text file, or copies data from the clipboard, itdisplays a portion of the raw data in the Preview pane of the dialog box. Youcan use this display to verify that the file contains the data you expected.The Import Wizard also attempts to process the data, identifying the delimiterused in the data.

The Import Wizard displays the variables it has created basedon its interpretation of the delimiter, using tabbed panels to display multiplevariables.For example, in the following figure, the Import Wizard has opened this samplefile, grades.txt.JohnAnnMartinRob85901007790929586959897936-56Importing and Exporting DataNumber of linesof header textignoredDelimiter foundin filePreview of thedata in the file.Preview of thevariables theImport Wizardcreates.In the figure, note how the Import Wizard has correctly identified the tabcharacter as the delimiter used in the file and has created three variables fromthe data:• data -- containing all the numeric data in the file• textdata -- containing all the text found in the file• rowheaders -- containing the names in the left-most column of data.Handling Alphabetic Data.

The Import Wizard recognize data files that use row orcolumn headers and extract these headers into separate variables. It can alsoignore any text header lines that may precede the data in a file.Specifying Other Delimiters. If the Import Wizard cannot determine the delimiterused in the data, it displays a preview of the raw data, as before, but thevariables it displays will not be correct. If your data uses a character other thana comma, space, tab, or semicolon as a delimiter, you must specify it by clickingthe Other button and entering the character in the text box.

The ImportWizard immediately reprocesses the data, displaying the new variables itcreates.6-6Importing Text DataSelecting the Variables to ImportThe Import Wizard displays a list of the variables it has created from your data.You can select which variables you want to import by clicking in the check boxnext to its name. By default, all variables are selected.The Import Wizard displays the contents of the variable that is highlighted inthe list in the right pane of the dialog box. To view the contents of one of theother variables, click on it. Choose the variables you want to import and clickNext.List of variables to beimported.Import Wizard displayscontent of the variablehighlighted in the list.Changing the Variable Selection.

By default, the Import Wizard puts all thenumeric data in the file into one variable. If the file contains text data, theImport Wizard puts it in a separate variable. If the file contains row- orcolumn-headers, the Import Wizard puts them in a separate variables, calledrowheaders or colheaders, respectively.In some cases, it might be more convenient to create variables out of each rowor column of data and use the row headers or column header text as the nameof each variable. To do this, click the appropriate button from the list of buttonsat the top of the dialog box.6-76Importing and Exporting DataFor example, it would ease calculations of the student averages it we createdseparate variables for each student that contained that student’s grades. Tocreate these variables, click the Create variables from each column usingrow names button.

When you click this option, the Import Wizard reprocessesthe file creating these new variables..Select option to createvariables from row header.List contains variables byrow header.Variable is a vector madefrom row of data file.When you are satisfied with the list of variables to be imported, click Next tobring the data into the MATLAB workspace.

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

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

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

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