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

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

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

The table lists the binary formats andthe MATLAB high-level functions you use to import them, with pointers tosources of additional information.Table 6-7: Binary Data Formats and MATLAB Export FunctionsData FormatFileExtensionDescriptionAudio files.au.wavUse the auwrite function to export audio files on SunMicrosystems platforms and the wavwrite function toexport audio files in Microsoft Windows format.Audio VideoInterleaved (AVI).aviYou must use the avifile, addframe, and the closefunction overloaded for AVI data to export a sequence ofMATLAB figures in AVI format. See “Exporting MATLABGraphs in AVI Format” on page 6-27 for more information.Hierarchical DataFormat (HDF).hdfTo export image data in HDF format, use imwrite. For allother HDF formats, see “Working with HDF Data” onpage 6-29 for complete information.Image files.jpeg.tiff.bmp.png.hdf.pcx.xwdUse the imwrite function to export image data in manydifferent formats.

See Reading, Writing, and QueryingGraphics Image Files for more information.6-256Importing and Exporting DataData FormatFileExtensionDescriptionMATLABproprietary format(MAT-files).matUse the save command to export data in MATLABproprietary format. See “Saving the Current Workspace”on page 5-5 for more information.Spreadsheets.xls.wk1Use the wk1write function to export data in Lotus 123format.To view the alphabetical list of MATLAB binary data export functions, seeTable 6-6.If MATLAB does not support a high-level function that works with a dataformat, you can use the MATLAB low-level file I/O functions, if you know howthe binary data is formatted in the file. See “Using Low-Level File I/OFunctions” on page 6-51 for more information.Table 6-8: Binary Data Export Functions6-26FunctionFile ExtensionData Formataddframe.auCapture snapshots of the current axes and put themin an AVI file object.

See also avifile.auwrite.auExport sound data in Sun Microsystems format.avifile.auExport audio-visual data in AVI format. Creates anAVI file object. See also addframe.hdf.hdfExport data in Hierarchical Data Format (HDF). ForHDF image file formats, use imwrite.

For all otherHDF files, see “Working with HDF Data” on page6-29 for complete information.imwrite.jpeg, .tiff,.bmp, .png,.hdf, .pcx, .xwdExport image files in many formats.save.matExport MATLAB variables in MAT-files format.Exporting Binary DataFunctionFile ExtensionData Formatwavwrite.wavExport sound data on Microsoft Windows platforms.wk1write.wk1Export data in Lotus 123 spreadsheet format.Exporting MATLAB Graphs in AVI FormatIn MATLAB, you can save a sequence of graphs as a movie that can then beplayed back using the movie function. You can export a MATLAB movie bysaving it in MAT-file format, like any other MATLAB workspace variable.However, anyone who wants to view your movie must have MATLAB. (Formore information about MATLAB movies, see the “Animation” section in UsingMATLAB Graphics.)To export a sequence of MATLAB graphs in a format that does not requireMATLAB for viewing, save the figures in Audio Video Interleaved (AVI)format.

AVI is a file format that allows animation and video clips to be playedon a PC running Windows or on UNIX systems.Creating an AVI Format MovieTo export a sequence of MATLAB graphs as an AVI format movie, performthese steps:1 Create an AVI file, using the avifile function.2 Capture the sequence of graphs and put them into the AVI file, using theaddframe function.3 Close the AVI file, using the close function, overloaded for AVI files.Note To convert an existing MATLAB movie into an AVI file, use themovie2avi function.For example, this code example exports a sequence of MATLAB graphs as theAVI file mymovie.avi. The numbers in comments correspond to notes followingthe code example.6-276Importing and Exporting Dataaviobj = avifile('mymovie.avi','fps',5);for k=1:25h = plot(fft(eye(k+16)));set(h,'EraseMode','xor');axis equal;frame = getframe(gca);aviobj = addframe(aviobj,frame);endaviobj = close(aviobj);Note the following items in this code example:• The avifile function creates an AVI file and returns a handle to an AVI fileobject.

AVI file objects support properties that let you control variouscharacteristics of the AVI movie, such as colormap, compression, and quality.(See the avifile reference page for a complete list.) avifile uses defaultvalues for all properties, unless you specify a value. In the example, the callto avifile explicitly sets the value of one frames per second (fps) property.• The example uses a for loop to capture the series of graphs to be included inthe movie.

You typically use addframe to capture a sequence of graphs forAVI movies. However, because this particular MATLAB animation uses XORgraphics, you must call getframe to capture the graphs and then calladdframe to add the captured frame to the movie. See the addframe referencepage for more information.• The example calls the close function to finish writing the frames to the fileand to close the file.6-28Working with HDF DataWorking with HDF DataHierarchical Data Format (HDF) is a general-purpose, machine-independentstandard for storing scientific data in files.

The National Center forSupercomputing Applications (NCSA), the original developer of HDF,distributes libraries of C and Fortran routines that scientists use to read andwrite data in HDF format.This section describes how to call these NCSA routines from within MATLAB.Topics include:• An overview of MATLAB HDF support• MATLAB HDF function calling conventions• Importing HDF data into the MATLAB workspace• Exporting MATLAB data in an HDF file• Including metadata in an HDF file• Using MATLAB specific HDF functionsAdditional Information SourcesThis section does not attempt to describe all HDF features and routines.

To usethe MATLAB HDF interface effectively, you must use this documentation inconjunction with the official HDF documentation, available in many formats atthe NCSA Web site (http://hdf.ncsa.uiuc.edu/). In particular, consult thefollowing documentation:• The HDF User’s Guide, which describes key HDF concepts and programmingmodels and provides tutorial information about using the library routines• The HDF Reference Manual, which provides detailed reference informationabout the hundreds of HDF routines, their arguments, and return valuesThe National Aeronautics and Space Administration (NASA) has created anextension of HDF as one of the data standards for the Earth Observing System(EOS).

For information about this extension to HDF, consult the officialHDF-EOS documentation at the EOS Web site(http://hdfeos.gsfc.nasa.gov/hdfeos/workshop.html).Finally, for details about the syntax of the MATLAB HDF functions, consultthe MATLAB online Function Reference. For most HDF routines, the6-296Importing and Exporting DataMATLAB syntax is essentially the same as the HDF version; however, forcertain routines, the MATLAB version has a different syntax.Overview of MATLAB HDF SupportThe NCSA organizes the routines in the HDF library into collections, calledExternal Interfaces (APIs).

Each API works with particular type of data. Forexample, the HDF Scientific Data (SD) API works with multidimensionalarrays of numeric data. Table , , lists all the HDF APIs supported by MATLAB(listed alphabetically by acronym). The table includes a MATLAB specific APImade up of utility functions.In addition to these standard HDF APIs, MATLAB also supports the EOSextension to HDF. HDF-EOS provides functions to store, manage, and retrievemultidimensional arrays of numeric data, point data, and swath data. See theHDF-EOS documentation for more information.Note MATLAB supports the version 4.1r3 of the NCSA multifile APIs toHDF data. The multifile APIs replace the original NCSA APIs. MATLAB doesnot support HDF version 5.0, which is a completely new format and is notcompatible with version 4.1r3.Table 6-9: Supported HDF Application Programming Interfaces (APIs)6-30ApplicationProgrammingInterfaceAcronymDescriptionAnnotationsANStores, manages, and retrieves text used to describean HDF file or any of the data structures contained inthe file.General RasterImagesDF24DFR8Stores, manages, and retrieves raster images, theirdimensions and palettes.

It can also manipulateunattached palettes.Note: Use the MATLAB high-level functions imreadand imwrite with HDF raster image formats.Working with HDF DataTable 6-9: Supported HDF Application Programming Interfaces (APIs)ApplicationProgrammingInterfaceAcronymDescriptionHDF UtilitiesH, HD, and HEProvides functions to open and close HDF files andhandle errors.MATLAB HDFUtilitiesMLProvides utility functions that help you work withHDF files in the MATLAB environment.Scientific DataSDStores, manages, and retrieves multidimensionalarrays of character or numeric data, along with theirdimensions and attributes.V GroupsVCreates and retrieves groups of other HDF dataobjects, such as raster images or V data.V DataVSVFVHStores, manages, and retrieves multivariate datastored as records in a table.MATLAB HDF Function Calling ConventionsEach HDF API includes many individual routines to read data from files, writedata to files, and perform other related functions.

For example, the HDF SDAPI includes separate C routines to open (SDopen), close (SDend), and read data(SDreaddata).MATLAB, instead of supporting a corresponding function for each individualHDF API routine, supports a single function for each HDF API. You use thissingle function to access all the individual routines in the HDF API, specifyingthe name of the individual HDF routine as the first argument.For example, to call the HDF SD API routine to terminate access to an HDFfile in a C program, you usestatus = SDend(sd_id);To call this routine from MATLAB, use the MATLAB function associated withthe API.

By convention, the name of the MATLAB function associated with anHDF API includes the API acronym in the function name. For example, theMATLAB function used to access routines in the HDF SD API is called hdfsd.6-316Importing and Exporting DataAs the first argument to this function, specify the name of the API routine,minus the acronym, and pass the remaining arguments expected by the routinein the order they are required. Thus, to call the SDend routine from MATLAB,use this syntax.status = hdfsd('end',sd_id);Note For some HDF API routines, particularly those that use outputarguments to return data, the MATLAB calling sequence is different.

(See“Handling HDF Routines with Output Arguments” on page 6-32 for moreinformation.) Refer to the MATLAB online Function Reference to make sureyou have the correct syntax.Handling HDF Routines with Output ArgumentsWhen calling HDF API routines that use output arguments to return data, youmust specify all output arguments as return values.

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

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

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

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