Programming Fundamentals - The MathWorks - #651

/ 840


catalogue search
P. 651
P. 652
P. 653
P. 654
P. 655
P. 656
P. 657
P. 658
P. 659
P. 660
P. 661
P. 662
P. 663
P. 664
P. 665
P. 666
P. 667
P. 668
P. 669
P. 670
P. 671
P. 672
P. 673
P. 674
P. 675
P. 676
P. 677
P. 678
P. 679
P. 680
P. 681
P. 682
P. 683
P. 684
P. 685
P. 686
P. 687
P. 688
P. 689
P. 690
P. 691
P. 692
P. 693
P. 694
P. 695
P. 696
P. 697
P. 698
P. 699
P. 700


See other catalogues for The MathWorks

Text version of the page
Hierarchical Doto Formot ]HDF4) Flit
Step 3: Writing MAT LAB Data to an HDF4 File. After creating an HDF4 file and creating a data set in the file, you can write data to the entire data set or just a portion of the data set. In the HDF4 SD API, you use the SDwritedata routine. In MATLAB, use the hdf sd function, specifying as arguments:
• Name of the SD API routine, 1 writedata1 in this case
• Valid HDF4 SU data set identifier, sds_id, returned by SDcreate
" Location in the data set where you want to start writing data, called the Start vector in HDF4 terminology
" Number of elements along each dimension to skip between each write Operation, called the stride vector in HDF4 terminology
• Total number of elements to write a Ions 'KK.h dimension, called the edges vector in HDF4 terminology
• MATLAB array to be written
Note You must specify the values of the start, stride, and edges arguments in row-major order, rather than the column-major order used in MATLAB. Note how the example uses f liplr to reverse the order of the dimensions in the vector returned by the size function before assigning it as the value of the edges argument.
The values you assign to these arguments depend on the MATLAB array you want to export. For example, the following code fragment writes this MATLAB 3-by-5 array of doubles,
A=[ 1234 5; 678910; 11 12 13 14 15 ];
into an HDF4 file:
ds_start = zeros(1 :ndims(A||;
dsstride = [];
ds_edges = fliplr(size(A>);
% Start at the beginning % Write every element. % Reverse the dimensions.
stat = hdfsd('writedata',sds_id,...
7-G7

pageCatalog pdf di En 2012-06-22-01