<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" version="2.0">
  <channel>
    <title>プログラムなど個人的メモ</title>
    <link>http://memo-memo-and-memo.asablo.jp/blog/</link>
    <description/>
    <language>ja</language>
    <generator>mc 0.0</generator>
    <pubDate>Fri, 08 Mar 2013 22:02:55 +0900</pubDate>
    <item>
      <title>HDF5 : 構造体(COMPOUND型)の書込み</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/27/6733014</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/27/6733014</guid>
      <pubDate>Wed, 27 Feb 2013 22:02:19 +0900</pubDate>
      <dcterms:modified>2013-03-08T22:02:55+09:00</dcterms:modified>
      <dcterms:created>2013-02-27T23:33:26+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;構造体データの書込み&lt;BR&gt;&lt;BR&gt;HDFViewをいじって、データの追加などしてみると、通常のDatasetの追加と異なり、CompoundDS(合成型)というものがあるのに気づくと思う。今回はこれの書込み。&lt;BR&gt;&lt;BR&gt;このデータを書き込むには構造体が必要になる。ただ構造体を宣言するのではなく、structLayout属性を追加しなければならない。これを宣言しないと外部DLLに数値を渡せない。引数のlayoutKindはsequentialを選んで構造体の宣言順にデータにする。さらにパラメータにあるPackを宣言して1バイトずつパックする宣言を追加する。&lt;PRE style="background: white; color: black; font-family: ＭＳ ゴシック; font-size: 13px;"&gt;[&lt;SPAN style="color: rgb(43, 145, 175);"&gt;StructLayout&lt;/SPAN&gt;(&lt;SPAN style="color: rgb(43, 145, 175);"&gt;LayoutKind&lt;/SPAN&gt;.Sequential,Pack = 1)]&#13;
&lt;SPAN style="color: blue;"&gt;struct&lt;/SPAN&gt; TestStruct&#13;
{&#13;
   &lt;SPAN style="color: blue;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt; TestInt;&#13;
   &lt;SPAN style="color: blue;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt; TestDouble;&#13;
}&lt;/PRE&gt;続いてHDF5ファイルの書込み準備。&lt;BR&gt;必要なIDを準備する。&lt;BR&gt;H5DataSpaceId :&lt;BR&gt; 　データの配列などの大きさを指定する。今までの記事を参照&lt;BR&gt;&lt;BR&gt;H5DataTypeId : &lt;BR&gt;　H5Tクラスにあるcreateメソッドを使用する。引数にH5TクラスにあるCreateClassの列挙より&amp;quot;COMPOUND&amp;quot;を選択する。もう一つの引数には一つのデータのサイズをバイト単位で指定する。もしint型とdouble型を合成型に書き込む場合は合計サイズ4+8=12バイトを指定する。&lt;PRE style="background: white; color: black; font-family: ＭＳ ゴシック; font-size: 13px;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; typeID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.create( &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;CreateClass&lt;/SPAN&gt;.COMPOUND,12);&#13;
&lt;/PRE&gt;さらに、このDataTypeIdを使用して、データ領域を指定していく。&lt;BR&gt;使用するメソッドはH5Tクラスにあるinsertメソッド。引数は以下の通り。&lt;BR&gt;　compoundDataType : 上記のH5DataTypeIdを指定&lt;BR&gt;　fieldName : string型。データの名前HDFViewで表示するときや、データを参照する際に使用する&lt;BR&gt;　offset : int型。データが始まる位置。詳しくは下記の例を参照&lt;BR&gt;　fieldId : H5DataTypeId型。挿入するデータの型。&lt;BR&gt;使用方法は下記のようにint型を挿入する場合はfieldId部には&amp;quot;NATIVE_INT&amp;quot;の列挙を使用して作成したH5DataTypeIdクラスを、double型を使用する場合は&amp;quot;NATIVE_DOUBLE&amp;quot;の列挙など、書き込むデータに合わせてH5DataTypeIdを作成する。&lt;BR&gt;offsetには最初は0を指定すればいいが、次に挿入を行う場合には前回までのデータをサイズを足して書いていかなければならない。もちろん上記のCompoundのH5DataTypeIdを指定した時のサイズを超えてはならない。&lt;PRE style="background: white; color: black; font-family: ＭＳ ゴシック; font-size: 13px;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; intTypeId = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.copy(&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Type&lt;/SPAN&gt;.NATIVE_INT);&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.insert(typeID, &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;IntTestData&amp;quot;&lt;/SPAN&gt;, 0, intTypeId);&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; doubleTypeId = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.copy(&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Type&lt;/SPAN&gt;.NATIVE_DOUBLE);&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.insert(typeID, &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;DoubleTestData&amp;quot;&lt;/SPAN&gt;, 4, doubleTypeId);&lt;/PRE&gt;上記の&amp;quot;H5T.insert&amp;quot;メソッドにて、1番目に使用する&amp;quot;H5DataTypeId&amp;quot;を使用して&amp;quot;H5DataSetId&amp;quot;を作成し、H5Arrayクラスを作成して書き込む。write時に使用するジェネリックの型はもちろん使用する配列型を使用する。&lt;PRE style="background: white; color: black; font-family: ＭＳ ゴシック; font-size: 13px;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; setID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.create(fileID, &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;COMPOUND&amp;quot;&lt;/SPAN&gt;, typeID, spaceID);&#13;
TestStruct testData = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; TestStruct();&#13;
testData.TestDouble = 0.123456;&#13;
testData.TestInt = -123;&#13;
TestStruct[]　testArray = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; TestStruct[]{testData};&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;TestStruct&amp;gt; array = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;TestStruct&amp;gt;(&lt;SPAN style="color: blue;"&gt;&lt;FONT color="#000000"&gt;testArray&lt;/FONT&gt;&lt;/SPAN&gt;);&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.write&amp;lt;TestStruct&amp;gt;(setID, typeID, array);&lt;/PRE&gt;あとは毎度のようにIDの解放処理を行う。&lt;BR&gt;&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5DotNet : Enumデータの書込・読込</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/19/6725526</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/19/6725526</guid>
      <pubDate>Tue, 19 Feb 2013 22:24:58 +0900</pubDate>
      <dcterms:modified>2013-02-22T22:30:32+09:00</dcterms:modified>
      <dcterms:created>2013-02-19T22:56:38+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;ENUMデータの書込み、読込みについて。&lt;BR&gt;&lt;BR&gt;ENUMデータを書き込むには、&amp;quot;H5T&amp;quot;クラスにある&amp;quot;createEnum&amp;quot;メソッドを使用して&amp;quot;H5DataTypeID&amp;quot;クラスを作成する。引数は&amp;quot;H5T.H5Type&amp;quot;の列挙なので、適当に指定。NATIVE_INTなどでいいと思う。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; typeID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.enumCreate( &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Type&lt;/SPAN&gt;.NATIVE_INT );&lt;/PRE&gt;次に、書き込むデータとHDFViewなどを使用した場合に表示されるデータを準備する。使うメソッドは&amp;quot;H5T&amp;quot;クラスにある&amp;quot;enumInsert&amp;quot;のジェネリックメソッド。&lt;BR&gt;引数は以下の通り&lt;BR&gt;　&amp;quot;typeId&amp;quot; : &amp;quot;H5DataTypeId&amp;quot;クラス、上記のメソッドで取得したものを使用する&lt;BR&gt;　&amp;quot;name&amp;quot; : &amp;quot;string&amp;quot;クラス 、表示する名前&lt;BR&gt;　&amp;quot;value&amp;quot; : &amp;quot;ref int&amp;quot;クラス 、名前表示と関係させる値&lt;BR&gt;例えば、bool値&amp;quot;True&amp;quot;と&amp;quot;False&amp;quot;を作成する場合は、以下のようにする。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt; f_index = &lt;SPAN style="color: purple;"&gt;0&lt;/SPAN&gt;;&lt;BR&gt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt; t_index = &lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt;;&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.enumInsert&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( typeID, &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;FALSE&amp;quot;&lt;/SPAN&gt;, &lt;SPAN style="color: blue;"&gt;ref&lt;/SPAN&gt; f_index );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.enumInsert&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( typeID, &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;TRUE&amp;quot;&lt;/SPAN&gt;, &lt;SPAN style="color: blue;"&gt;ref&lt;/SPAN&gt; t_index );&lt;/PRE&gt;あとは&amp;quot;H5DataSetId&amp;quot;クラスを作成して、&amp;quot;write&amp;lt;&amp;gt;&amp;quot;してやればいい。&lt;BR&gt;&lt;BR&gt;値を読み込む場合は、値型を読み込む方法を行えば、数値が取得できる。&lt;BR&gt;その後、&amp;quot;H5DataTypeId&amp;quot;クラスを使用して表示名を取り出す。取り出す際に使用するメソッドは&amp;quot;H5T&amp;quot;クラスにある&amp;quot;enumNameOf&amp;quot;というジェネリックメソッドを使用する。引数、戻り値は以下の通り。&lt;BR&gt;　&amp;quot;typeId&amp;quot; : &amp;quot;H5DataTypeId&amp;quot;クラス、読み込み時に使用したもの&lt;BR&gt;　&amp;quot;value&amp;quot; : &amp;quot;ref int&amp;quot;クラス、データと関連付けた値を使用。要は読み取り時に取得した値。&lt;BR&gt;　戻り値：&amp;quot;string&amp;quot;クラス。関連付けた名前&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt; name = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.enumNameOf&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( rTypeID, &lt;SPAN style="color: blue;"&gt;ref&lt;/SPAN&gt; index );&#13;
&lt;/PRE&gt;戻ってきた値を調べて、再びenum値に戻してやればC#上で使用できるようになる。&lt;BR&gt;以下、サンプル。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: green;"&gt;//	書込みサンプル&lt;BR&gt;&lt;/SPAN&gt;H5FileId&lt;/SPAN&gt; fileID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.open( &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;&lt;/SPAN&gt;, &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;OpenMode&lt;/SPAN&gt;.ACC_RDWR );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSpaceId&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; spaceID = &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.create_simple( &lt;/FONT&gt;&lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;, &lt;/FONT&gt;&lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; &lt;/FONT&gt;&lt;SPAN style="color: blue;"&gt;long&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;[] { &lt;/FONT&gt;&lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; } );&#13;
&lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; typeID = &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.enumCreate( &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.&lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Type&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.NATIVE_INT );&lt;/FONT&gt;&lt;BR&gt;H5DataSetId&lt;/SPAN&gt; dataSetID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.create( fileID,&lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;ENUMDataSet&amp;quot;&lt;FONT color="#000000"&gt;,typeID ,spaceID &lt;/FONT&gt;&lt;/SPAN&gt; );&#13;
&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;[] intArray = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;[] { &lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt; };&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt; array = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( intArray );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.write&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( dataSetID, dataTypeId, array );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.close( dataSetID );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.close( dataTypeId );&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.close( spaceID );&#13;
&lt;/FONT&gt;H5F&lt;/SPAN&gt;.close( fileID );&lt;/PRE&gt;&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: green;"&gt;//	読み込みサンプル&lt;BR&gt;&lt;/SPAN&gt;H5FileId&lt;/SPAN&gt; fileID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.open( &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;&lt;/SPAN&gt;, &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;OpenMode&lt;/SPAN&gt;.ACC_RDWR );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; datasetID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.open( fileID, &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;ENUMDataSet&amp;quot;&lt;/SPAN&gt; );&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; typeId = &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.getType( datasetID );&#13;
&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;[] intArray = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;[&lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt;];&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt; array = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( intArray );&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.read&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( datasetID , typeId , &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( array ) );&#13;
&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt; index = intArray[ &lt;SPAN style="color: purple;"&gt;0&lt;/SPAN&gt; ];&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: green;"&gt;//	これで文字列で関連付けた表示が取得される。&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt; name = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.enumNameOf&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( typeId , &lt;SPAN style="color: blue;"&gt;ref&lt;/SPAN&gt; index );&#13;
&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.close( dataSetID );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.close( typeId );&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.close( fileID );&lt;/PRE&gt;&lt;BR&gt;　&lt;BR&gt;　&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>プログラムでの値型の精度とか</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/15/6721444</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/15/6721444</guid>
      <pubDate>Fri, 15 Feb 2013 11:33:34 +0900</pubDate>
      <dcterms:modified>2013-02-19T16:35:37+09:00</dcterms:modified>
      <dcterms:created>2013-02-15T11:59:20+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;HDF5DotNetとは別でプログラムの話。&lt;BR&gt;&lt;BR&gt;プログラムで、多項式近似の係数を出力する機能がほしくなったので、適当にネットで転がっている情報をもとに作成。参考ページとできたのがこれ&lt;BR&gt;&lt;BR&gt;エクセルを用いた最小二乗法 : &lt;A href="http://homepage1.nifty.com/gfk/square_ren.htm" target="_blank"&gt;http://homepage1.nifty.com/gfk/square_ren.htm&lt;/A&gt;&lt;BR&gt;逆行列の求め方 : &lt;A href="http://thira.plavox.info/blog/2008/06/_c.html" target="_blank"&gt;http://thira.plavox.info/blog/2008/06/_c.html&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;プログラム&lt;PRE style="FONT-FAMILY: MS Gothic; BACKGROUND: white; COLOR: black"&gt;&lt;SPAN style="COLOR: green"&gt;//行列の作成&lt;BR&gt;&lt;/SPAN&gt;dimWithIntercept = &lt;FONT color="#800080"&gt;5&lt;/FONT&gt;&lt;FONT color="#000000"&gt;;&lt;/FONT&gt;&#13;
&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ , ] matrix = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ dimWithIntercept, dimWithIntercept];&#13;
&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ , ] copy = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ dimWithIntercept, dimWithIntercept ];&#13;
&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ , ] revMatrix = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ dimWithIntercept, dimWithIntercept ];&#13;
&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[] vector = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[dimWithIntercept];&#13;
&lt;SPAN style="COLOR: rgb(43,145,175)"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;&amp;gt; ret = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(43,145,175)"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;&amp;gt;( );&#13;
&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; digit = &lt;SPAN style="COLOR: purple"&gt;15&lt;/SPAN&gt;;&#13;
&lt;SPAN style="COLOR: rgb(43,145,175)"&gt;MidpointRounding&lt;/SPAN&gt; rounding = &lt;SPAN style="COLOR: rgb(43,145,175)"&gt;MidpointRounding&lt;/SPAN&gt;.AwayFromZero;&#13;
&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; i &amp;lt; xyValues.Count ; i++ ) {&#13;
&lt;SPAN style="COLOR: green"&gt;    //	行列の作成&lt;/SPAN&gt;&#13;
&lt;SPAN style="COLOR: blue"&gt;    for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; j = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; j &amp;lt; dimWithIntercept ; j++ ) {&#13;
	&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; k = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; k &amp;lt; dimWithIntercept ; k++ ) {&#13;
	    matrix[ j, k ] = matrix[ j, k ] + &lt;SPAN style="COLOR: rgb(43,145,175)"&gt;Math&lt;/SPAN&gt;.Pow( xyValues[ i ].Key, j );&#13;
	    copy[ j, k ] = matrix[ j, k ];&#13;
	}&#13;
&lt;SPAN style="COLOR: green"&gt;&lt;FONT color="#000000"&gt;    &lt;/FONT&gt;//ベクトルの作成&lt;/SPAN&gt;&#13;
    vector[ j ] = vector[ j ] + &lt;SPAN style="COLOR: rgb(43,145,175)"&gt;Math&lt;/SPAN&gt;.Pow(xyValues[ i ].Key, j ) ;&#13;
    }				&#13;
}&#13;
&lt;SPAN style="COLOR: green"&gt;//	逆行列の作成&lt;/SPAN&gt;&#13;
&lt;SPAN style="COLOR: green"&gt;//	まずは単位行列を作る&lt;/SPAN&gt;&#13;
&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; i &amp;lt; dimWithIntercept ; i++ ) {&#13;
&lt;SPAN style="COLOR: blue"&gt;    for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; j = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; j &amp;lt; dimWithIntercept ; j++ ) {&#13;
	revMatrix[ i,j ] = (i == j) ? &lt;SPAN style="COLOR: purple"&gt;1.0&lt;/SPAN&gt; : &lt;SPAN style="COLOR: purple"&gt;0.0&lt;/SPAN&gt;;&#13;
    }&#13;
}&lt;BR&gt;&lt;SPAN style="COLOR: green"&gt;//	吐き出し法&lt;/SPAN&gt;&#13;
&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt; buf;&#13;
&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; i &amp;lt; dimWithIntercept ; i++ ) {&#13;
&lt;SPAN style="COLOR: green"&gt;    //	単位化するために、対になる値で割る&lt;/SPAN&gt;&#13;
    buf = copy[ i, i ];&#13;
&lt;SPAN style="COLOR: green"&gt;    //	iの行を単位化するためにbufで割る&lt;/SPAN&gt;&#13;
&lt;SPAN style="COLOR: blue"&gt;&lt;FONT color="#000000"&gt;    &lt;/FONT&gt;for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; j = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; j &amp;lt; dimWithIntercept ; j++ ) {&#13;
	copy[ i, j ] = copy[ i, j ] / buf;&#13;
	revMatrix[ i, j ] = revMatrix[ i, j ] / buf;&#13;
    }&#13;
&lt;SPAN style="COLOR: blue"&gt;    for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; j = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; j &amp;lt; dimWithIntercept ; j++ ) {&lt;BR&gt;    &lt;SPAN style="COLOR: green"&gt;//	iと同じ行では計算しない&lt;/SPAN&gt;&#13;
	&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;( i != j ) {&#13;
	    buf = copy[ j, i ];&#13;
	    &lt;SPAN style="COLOR: green"&gt;//n列目の値を0にする(n,nの場所はスルー)&lt;/SPAN&gt;&#13;
	    &lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; k = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; k &amp;lt; dimWithIntercept ; k++ ) {&#13;
	        &lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt; a = copy[ i, k ] * buf;&#13;
		copy[ j, k ] = copy[ j, k ] - a;&lt;BR&gt;		a = revMatrix[ i, k ] * buf;&#13;
		revMatrix[ j, k ] =revMatrix[ j, k ] - a;&lt;BR&gt;	    }&#13;
	}    	&lt;BR&gt;    }&#13;
}&lt;/PRE&gt;とりあえずテストしてみて、エクセルのLINEST関数の結果と照らし合わせるなどして比較。いけそうだと思ったがうまくいかない場合がでてきた。その場合とは小数点の値を使う場合。たとえば、x = 0.1、0.2、0.3 を使用しての４次元の多項式y=a * x^4 + b * x^3 + c * x^2 + d * x^1 + e の各a,b,c,d,eを求めるために、各項を2乗、３乗としていったが、デバッグで値を見ると、後ろに妙な端数がある。&lt;BR&gt;これは、浮動小数点型を使用して計算を行うとどうしても誤差がでるらしい。&lt;BR&gt;&lt;A href="http://dobon.net/vb/dotnet/beginner/floatingpointerror.html" target="_blank"&gt;http://dobon.net/vb/dotnet/beginner/floatingpointerror.html&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;多少誤差が出ようが、似たような計算結果になってほしいところだが、実際に上記のプログラムを使用して算出された値を使い、使用したx値を与えてやっても同じようなy値が算出できなかった。&lt;BR&gt;&lt;BR&gt;なので、結局エクセルのLinEstクラスを使用するようにした。&lt;BR&gt;使用するには、HDF5DotNetの時と同じく、参照の追加を行わなければならない。追加するものは、COMにある&amp;quot;Microsoft Office xx(xxはofficeのバージョン)Object Library&amp;quot;。これを追加すると、ソリューションエクスプローラーの中の参照設定の中に&amp;quot;Microsoft.Office.Core&amp;quot;と&amp;quot;Microsoft.Office.Interop.Excel&amp;quot;が追加される。&lt;BR&gt;&lt;BR&gt;これでエクセルの編集などができるようになったが、あくまで目的はワークシート関数の&amp;quot;LinEst&amp;quot;を使用すること。&lt;BR&gt;&lt;BR&gt;とりあえず、簡単に以下のラッパークラスを作成した。&lt;PRE style="FONT-FAMILY: MS Gothic; BACKGROUND: white; COLOR: black"&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt;  &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CoefficientsClass&lt;/SPAN&gt;&#13;
{&#13;
&lt;SPAN style="COLOR: blue"&gt;    static&lt;/SPAN&gt; Excel.&lt;FONT color="#2b91af"&gt;Application&lt;/FONT&gt; oXL = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Excel.&lt;FONT color="#2b91af"&gt;Application&lt;/FONT&gt;( );&#13;
&lt;SPAN style="COLOR: blue"&gt;&lt;FONT color="#000000"&gt;    &lt;/FONT&gt;static&lt;/SPAN&gt; Excel.&lt;FONT color="#2b91af"&gt;WorksheetFunction&lt;/FONT&gt; funk = oXL.WorksheetFunction;&#13;
    &lt;BR&gt;&lt;SPAN style="COLOR: blue"&gt;    public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Array&lt;/SPAN&gt; GetCoefficients(&lt;SPAN style="COLOR: #2b91af"&gt;Array&lt;/SPAN&gt; y, &lt;SPAN style="COLOR: #2b91af"&gt;Array&lt;/SPAN&gt; x, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; a, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; b)&#13;
    {			&#13;
	System.&lt;SPAN style="COLOR: #2b91af"&gt;Object&lt;/SPAN&gt; coefficients = funk.LinEst( y, x, a, b );&#13;
	&lt;SPAN style="COLOR: #2b91af"&gt;Array&lt;/SPAN&gt; coeffArray = (&lt;SPAN style="COLOR: #2b91af"&gt;Array&lt;/SPAN&gt;)coefficients;&#13;
	&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; coeffArray;&#13;
    }&#13;
}&lt;/PRE&gt;説明するとstaticでエクセル起動とワークシート関数をクラスに置いておく。&lt;BR&gt;データを持ってきてLinEst関数を使用する。ただ単にラップしただけ。&lt;BR&gt;あとはこれを使うだけ&lt;PRE style="FONT-FAMILY: MS Gothic; BACKGROUND: white; COLOR: black"&gt;&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ , ] x = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ dim , xyValues.Count ];&#13;
&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[] y = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;[ xyValues.Count ];&#13;
&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; i &amp;lt; xyValues.Count ; i++ ) {&#13;
&lt;SPAN style="COLOR: blue"&gt;    for&lt;/SPAN&gt;( &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; j = &lt;SPAN style="COLOR: purple"&gt;0&lt;/SPAN&gt; ; j &amp;lt; dim ; j++ ) {&#13;
	x[ j, i ] = &lt;SPAN style="COLOR: #2b91af"&gt;Math&lt;/SPAN&gt;.Round(&lt;SPAN style="COLOR: #2b91af"&gt;Math&lt;/SPAN&gt;.Pow(xyValues[i].Key,j + &lt;SPAN style="COLOR: purple"&gt;1&lt;/SPAN&gt;),&lt;BR&gt;&lt;SPAN style="COLOR: purple"&gt;		15&lt;/SPAN&gt;,&lt;SPAN style="COLOR: #2b91af"&gt;MidpointRounding&lt;/SPAN&gt;.AwayFromZero);&#13;
    }&#13;
    y[ i ] = xyValues[ i ].Value;&#13;
}&#13;
 &#13;
&lt;SPAN style="COLOR: #2b91af"&gt;Array&lt;/SPAN&gt; coeffArray = &lt;FONT color="#2b91af"&gt;CoefficientsClass&lt;/FONT&gt;.GetCoefficients( y, x ,&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;,&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;);&#13;
&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;&amp;gt; ret = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;&amp;gt;();&#13;
&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = &lt;SPAN style="COLOR: purple"&gt;1&lt;/SPAN&gt; ; i &amp;lt; coeffArray.Length + &lt;SPAN style="COLOR: purple"&gt;1&lt;/SPAN&gt; ; i++){&#13;
    ret.Add( (&lt;SPAN style="COLOR: blue"&gt;double&lt;/SPAN&gt;)coeffArray.GetValue( i ) );&#13;
}&lt;/PRE&gt;xを配列単体で行うとy=ax+bの係数と切片が得られる。xを上記のように二次配列にして、ほしい次元まで乗数倍したx値を用意すれば、多項近似式も得ることができる。&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5 : 可変長文字列の書き込み</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/14/6721077</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/14/6721077</guid>
      <pubDate>Thu, 14 Feb 2013 21:35:23 +0900</pubDate>
      <dcterms:modified>2013-02-15T22:16:02+09:00</dcterms:modified>
      <dcterms:created>2013-02-14T22:24:29+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;可変長な文字列の書き込みと読み込みについて&lt;BR&gt;文字の書き込みと読み込みについては、一度固定長の文字列について言及したが、今回は可変長の文字列について&lt;BR&gt;&lt;BR&gt;書き込みには&amp;quot;H5DataSetId&amp;quot;クラス(&amp;quot;H5DataSetId&amp;quot;クラスを作成するには”H5DataSpaceId”クラスと&amp;quot;H5DataTypeId&amp;quot;クラスが必要)と&amp;quot;H5DataTypeId&amp;quot;クラスが必要になる点はかわらない。&lt;BR&gt;違う点について、&lt;BR&gt;　固定長時は文字列を文字列データとして扱うために、byte配列に変換、変換データを用いて&amp;quot;H5DataType&amp;quot;クラスのサイズ設定と”write&amp;lt;&amp;gt;”メソッドをbyte型にて実行した。&lt;BR&gt;　可変長時はC++などで使用するポインタを使用(といってもポインタを意識するような使い方はしなくてもよい)して、&amp;quot;H5DataSetId&amp;quot;クラスの作成や&amp;quot;write&amp;lt;&amp;gt;&amp;quot;メソッドの実行を行う。&lt;BR&gt;&lt;BR&gt;&amp;quot;H5DataSpaceId&amp;quot;クラスの作成については、今までと変わらないので、固定長のものを参考に、ここでは割愛。&lt;BR&gt;&lt;BR&gt;&amp;quot;H5DataTypeId&amp;quot;クラスを作成する場合は、&amp;quot;H5T&amp;quot;クラスの&amp;quot;create&amp;quot;メソッドを使用するが、引数の&amp;quot;size&amp;quot;(int型)に-1を指定する。これは、可変長の文字列を使用するときには必ず行う。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; typeID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.create(&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;CreateClass&lt;/SPAN&gt;.STRING,-&lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt;);&#13;
&lt;/PRE&gt;&amp;quot;H5DataSetId&amp;quot;クラスは上記の&amp;quot;H5DataSpaceId&amp;quot;クラスと&amp;quot;H5DataTypeId&amp;quot;で作成。作成方法は今までと同じなので割愛。&lt;BR&gt;&lt;BR&gt;次に文字列のデータの作成。文字列データへの変換には&amp;quot;UTF８Encoding&amp;quot;クラスなどのEncoding系クラスを使用せず、System.Runtime.InteropServices空間にある&amp;quot;Marshal&amp;quot;クラスにある&amp;quot;StringToHGlobalAnsi&amp;quot;メソッドを使用する。引数は&amp;quot;string&amp;quot;クラス、戻り値は&amp;quot;IntPtr&amp;quot;構造体。要するに、アンマネージ領域に文字列データを用意しておき、ポインタを使用して書き込む。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;IntPtr&lt;/SPAN&gt; stringPtr = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;Marshal&lt;/SPAN&gt;.StringToHGlobalAnsi( stringValue );&#13;
&lt;/PRE&gt;これで、&amp;quot;H5D&amp;quot;クラスの&amp;quot;write&amp;lt;&amp;gt;&amp;quot;メソッドを実行する。ジェネリックの指定はもちろん&amp;quot;IntPtr&amp;quot;構造体を使用する。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;&amp;lt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;IntPtr&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;&amp;gt; dataArray = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;IntPtr&lt;/SPAN&gt;&amp;gt;( &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; []{stringPtr} );&lt;/FONT&gt;&lt;BR&gt;H5D&lt;/SPAN&gt;.write&amp;lt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;IntPtr&lt;/SPAN&gt;&amp;gt;( datasetID, ftypeID, dataArray ) );&#13;
&lt;/PRE&gt;使用後は、&amp;quot;close&amp;quot;メソッドができるものは行う。&amp;quot;IntPtr&amp;quot;構造体については&amp;quot;Marshal&amp;quot;クラスにある&amp;quot;FreeHGlobal&amp;quot;メソッドを使用してメモリを開放する。引数は&amp;quot;IntPtr&amp;quot;構造体。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;Marshal&lt;/SPAN&gt;.FreeHGlobal( stringPtr );&#13;
&lt;/PRE&gt;以下、サンプル。&lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; width: 476px; height: 296px; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#0000ff"&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5FileId&lt;/SPAN&gt; fileID = &lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.create(&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;C:\\Test.hdf5&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt; , &lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.&lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;CreateMode&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.ACC_TRUNC );&lt;/FONT&gt;&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; typeID = &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.create(&lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.&lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;CreateClass&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.STRING,-&lt;/FONT&gt;&lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;);&#13;
&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; datasetID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.create( fileID, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;VariableStr&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;, typeID, spaceID );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;string &lt;/FONT&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;stringValue =&lt;/FONT&gt;&lt;FONT color="#0000ff"&gt; &lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;This is TestString.&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;IntPtr&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; stringPtr = &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;Marshal&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.StringToHGlobalAnsi( stringValue );&lt;BR&gt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;&amp;lt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;IntPtr&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;&amp;gt; dataArray = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;IntPtr&lt;/SPAN&gt;&amp;gt;( &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; []{stringPtr} );&lt;/FONT&gt;&lt;BR&gt;H5D&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.write&amp;lt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;IntPtr&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;&amp;gt;( datasetID, typeID, dataArray ) );&lt;/FONT&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.close( datasetID );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.close( typeID ); &lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;.close( spaceID );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.close( fileID );&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;Marshal&lt;/SPAN&gt;.FreeHGlobal( stringPtr );&lt;/PRE&gt;&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5DotNet : 文字列の読み込み</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/13/6720400</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/13/6720400</guid>
      <pubDate>Wed, 13 Feb 2013 22:59:04 +0900</pubDate>
      <dcterms:modified>2013-02-13T23:39:07+09:00</dcterms:modified>
      <dcterms:created>2013-02-13T23:39:07+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;HDF5ファイルから文字列データの読み込み方法&lt;BR&gt;&lt;BR&gt;文字列の読み込みについても、数値の読み込みと同様の手順を踏めば取り込むことができる。少し違うのが、取得する文字列のサイズを知らなければならない。&lt;BR&gt;&lt;BR&gt;まずは、数値の読み込みと同様に、&amp;quot;H5FileId&amp;quot;クラス、もしくは&amp;quot;H5GroupId&amp;quot;と、DataSetの名前を使用して、&amp;quot;H5DataSetId&amp;quot;クラスを取り出す。&lt;BR&gt;その後、取り出した&amp;quot;H5DataSetId&amp;quot;クラスより、&amp;quot;H5DataTypeId&amp;quot;クラスを得る。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; dataSetID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.open( fileID,&lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;TestStringDataSet&amp;quot;&lt;/SPAN&gt; );&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; dataTypeID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.getType( dataSetID );&lt;/PRE&gt;次に文字列データのサイズを取得する。&lt;BR&gt;以前に、文字列データの書き込みについて記述したように、書き込み時は文字列を&amp;quot;byte&amp;quot;型の配列に変換して保存した。なので、読み込み時も&amp;quot;byte&amp;quot;型の配列を得てから変換を行う必要がある。&lt;BR&gt;まずは、&amp;quot;byte&amp;quot;型配列の大きさを取得する。取得するには、&amp;quot;H5T&amp;quot;クラスにあるメソッド&amp;quot;getSize&amp;quot;を使用する。引数は&amp;quot;H5DataTypeId&amp;quot;、戻り値は&amp;quot;int&amp;quot;型。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;[] byteArray = &lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;new &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;[ &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.getSize(dataTypeID)];&lt;/PRE&gt;あとは値型の時と同じように&amp;quot;H5D&amp;quot;クラスの&amp;quot;read&amp;lt;&amp;gt;&amp;quot;メソッドでデータを読み込むジェネリックには&amp;quot;byte&amp;quot;型を指定する。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#2b91af"&gt;H5Array&lt;/FONT&gt;&lt;FONT color="#000000"&gt;&amp;lt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&amp;gt; array =&lt;/FONT&gt; new&lt;FONT color="#000000"&gt; &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;FONT color="#000000"&gt;&amp;lt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;( byteArray );&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.read&amp;lt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;gt;( dataSetID , dataTypeID , &lt;SPAN style="color: blue;"&gt;&lt;FONT color="#000000"&gt;array &lt;/FONT&gt;&lt;/SPAN&gt; );&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;これでbyteArrayのインスタンスに文字列データが格納されているので、&amp;quot;System.Text.Encoding&amp;quot;クラスにある&amp;quot;GetString&amp;quot;メソッドでデータを変換してやる。使用するエンコーディングは、保存時と同じものを使用する。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; testString = Syste.Text.&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#2b91af"&gt;Encoding&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;.UTF8.GetString&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;(byteArray);&lt;/PRE&gt;これで文字列の取得は完了。あとはおなじみの&amp;quot;close&amp;quot;メソッドを使用する。&lt;BR&gt;以下、サンプル&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5FileId&lt;/SPAN&gt; fileID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.open( &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;&lt;/SPAN&gt;, &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;OpenMode&lt;/SPAN&gt;.ACC_RDWR );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; dataSetID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.open( fileID,&lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;TestDataSet&amp;quot;&lt;/SPAN&gt; );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; dataTypeId = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.getType( dataSetID );&#13;
&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;[] byteArray = &lt;/FONT&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;new &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;[ &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;.getSize(dataTypeID)];&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#2b91af"&gt;H5Array&lt;/FONT&gt;&lt;FONT color="#000000"&gt;&amp;lt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&amp;gt; array =&lt;/FONT&gt; new&lt;FONT color="#000000"&gt; &lt;/FONT&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;FONT color="#000000"&gt;&amp;lt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;( byteArray );&lt;BR&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.read&amp;lt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;byte&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;gt;( dataSetID , dataTypeID , &lt;SPAN style="color: blue;"&gt;&lt;FONT color="#000000"&gt;array &lt;/FONT&gt;&lt;/SPAN&gt; );&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; testString = Syste.Text.&lt;/FONT&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#2b91af"&gt;Encoding&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;.UTF8.GetString&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;(byteArray);&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.close( dataSetID );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.close( dataTypeId );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.close( fileID );&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5DotNet : 値の読み込み</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/09/6716449</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/09/6716449</guid>
      <pubDate>Sat, 09 Feb 2013 21:05:14 +0900</pubDate>
      <dcterms:modified>2013-02-12T22:51:05+09:00</dcterms:modified>
      <dcterms:created>2013-02-09T21:15:00+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;数値型の読み込み方法について&lt;BR&gt;&lt;BR&gt;読み込みでは、&amp;quot;H5D&amp;quot;クラスにある、&amp;quot;read&amp;lt;&amp;gt;&amp;quot;のジェネリックメソッドを使用する。&lt;BR&gt;同じクラスにある&amp;quot;write&amp;lt;&amp;gt;&amp;quot;と同じ引数&amp;quot;H5DataSetId&amp;quot;と&amp;quot;H5TypeId&amp;quot;が必要なので、取得する必要がある。もう一つの引数は&amp;quot;H5Array&amp;lt;&amp;gt;&amp;quot;を指定する。&lt;BR&gt;&lt;BR&gt;まずは&amp;quot;H5D&amp;quot;クラスにある&amp;quot;open&amp;quot;メソッドを使用する。引数はfileOrGroupId(&amp;quot;H5FileOrGroupId&amp;quot;クラス)とdataSetName(&amp;quot;string&amp;quot;クラス)。戻り値は&amp;quot;H5DataSetId&amp;quot;。要はこのメソッドで&amp;quot;H5DataSetId&amp;quot;を取り出す。ただし、グループ内に指定の引数指定のdataSetNameがない場合は&amp;quot;Exception&amp;quot;をthrowするので注意。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; dataSetID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.open( fileID,&lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;TestDataSet&amp;quot;&lt;/SPAN&gt; );&#13;
&lt;/PRE&gt;&amp;quot;H5TypeId”クラスの取得については、上記で取得した&amp;quot;H5DataSetId&amp;quot;を使用して取得できる。&amp;quot;H5D&amp;quot;クラス内の、&amp;quot;getType&amp;quot;メソッドを使用。引数は上記で取得した&amp;quot;H5DataSetId&amp;quot;クラスを指定する。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; dataTypeID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.getType( dataSetID );&lt;/PRE&gt;あとは&amp;quot;H5Array&amp;lt;&amp;gt;&amp;quot;を準備する。ジェネリックなので型を指定する。インスタンス作成時の引数はジェネリックで指定した型の配列を入れる。この中にデータの中身が入れられる。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;int&lt;/FONT&gt;&lt;FONT color="#000000"&gt;[] intArray = &lt;/FONT&gt;&lt;FONT color="#0000ff"&gt;new int&lt;/FONT&gt;&lt;FONT color="#000000"&gt;[]{&lt;SPAN style="color: purple;"&gt;0&lt;/SPAN&gt;};&lt;/FONT&gt;&lt;BR&gt;H5Array&lt;FONT color="#000000"&gt;&amp;lt;&lt;FONT color="#0000ff"&gt;int&lt;/FONT&gt;&amp;gt; array =&lt;/FONT&gt;&lt;/SPAN&gt; new&lt;/SPAN&gt; &lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;FONT color="#000000"&gt;&amp;lt;&lt;FONT color="#0000ff"&gt;int&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;( myArray );&lt;/PRE&gt;仕上げに、&amp;quot;H5D&amp;quot;クラスの&amp;quot;read&amp;lt;&amp;gt;&amp;quot;ジェネリックメソッドを実行してデータを取り出す。&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.read&amp;lt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;gt;( dataSetID , dataTypeID , &lt;SPAN style="color: blue;"&gt;&lt;FONT color="#000000"&gt;array &lt;/FONT&gt;&lt;/SPAN&gt; );&lt;BR&gt;&lt;SPAN style="color: blue;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;&lt;FONT color="#0000ff"&gt;int &lt;/FONT&gt;&lt;FONT color="#000000"&gt;returnValue = intArray[0];&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;使用後は、&amp;quot;close&amp;quot;メソッドが使用できるものは閉じて終了。&lt;BR&gt;以下、サンプル&lt;PRE style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5FileId&lt;/SPAN&gt; fileID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.open( &lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;&lt;/SPAN&gt;, &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;OpenMode&lt;/SPAN&gt;.ACC_RDWR );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; dataSetID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.open( fileID,&lt;SPAN style="color: rgb(163, 21, 21);"&gt;&amp;quot;TestDataSet&amp;quot;&lt;/SPAN&gt; );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; dataTypeId = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.getType( dataSetID );&#13;
&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;[] intArray = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;[] { &lt;SPAN style="color: purple;"&gt;0&lt;/SPAN&gt; };&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt; array = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( intArray );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.read&amp;lt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt;&amp;gt;( dataSetID, dataTypeId, array );&#13;
&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt; returnValue = intArray[ &lt;SPAN style="color: purple;"&gt;0&lt;/SPAN&gt; ];&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.close( dataSetID );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.close( dataTypeId );&#13;
&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.close( fileID );&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5DotNet : グループの作成など</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/08/6715690</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/08/6715690</guid>
      <pubDate>Fri, 08 Feb 2013 22:03:25 +0900</pubDate>
      <dcterms:modified>2013-02-09T21:05:11+09:00</dcterms:modified>
      <dcterms:created>2013-02-08T22:56:41+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;グループの作成方法について&lt;BR&gt;&lt;BR&gt;HDFViewでは、データツリー表示部分にて、値が追加できる。&lt;BR&gt;簡単に書くと、&lt;BR&gt;&lt;BR&gt;データツリー部上でコンテキストメニュー表示(ファイルを読み込んでいない場合は先に読み込むorHDFViewのファイルメニューから作成する。)→New→DataSet→ダイアログを埋めていけばOK。&lt;BR&gt;&lt;BR&gt;このコンテキストメニュー上のNewの中には&amp;quot;Group&amp;quot;という項目もある。今回はこのグループを作成する。&lt;BR&gt;(HDFViewについてはまた別にメモするかも)&lt;BR&gt;&lt;BR&gt;さて、グループを作成するには&amp;quot;H5G&amp;quot;クラスにある&amp;quot;create&amp;quot;メソッドを使用する。引数と戻り値は以下の通り、&lt;BR&gt;　&lt;BR&gt;&lt;BR&gt;　引数&lt;BR&gt;　　&amp;quot;fileOrGroupId&amp;quot; : &amp;quot;H5LocId&amp;quot;インターフェース、名前の通り&amp;quot;H5FileId&amp;quot;クラス、もしくは&amp;quot;H5GroupId&amp;quot;クラスを指定する。&lt;BR&gt;　　&amp;quot;groupName&amp;quot; : &amp;quot;string&amp;quot;クラス、グループ名に使用される。&lt;BR&gt;　&lt;BR&gt;　&lt;BR&gt;　&lt;BR&gt;　戻り値&lt;BR&gt;　　&amp;quot;H5GroupId&amp;quot;クラス、最後はもちろん&amp;quot;H5G&amp;quot;の&amp;quot;close&amp;quot;メソッドで閉じる必要がある。&lt;BR&gt;&lt;BR&gt;上記の&amp;quot;fileOrGroupId&amp;quot;は、その名前の通り、&amp;quot;H5FileId&amp;quot;以外に&amp;quot;H5GroupId&amp;quot;も使用可能。なので何層もの階層を作成することができる。WiodowsのExplorerのような物として考えるとわかりやすい。以下グループ作成のサンプル。&lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5GroupId &lt;/SPAN&gt;groupID = &lt;FONT color="#2b91af"&gt;H5G&lt;/FONT&gt;&lt;FONT color="#000000"&gt;.create&lt;/FONT&gt;( fileID,&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;TestGroup&amp;quot;&lt;/SPAN&gt; );&lt;BR&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5GroupId &lt;FONT color="#000000"&gt;subG&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;roupID = &lt;/FONT&gt;&lt;FONT color="#2b91af"&gt;H5G&lt;/FONT&gt;&lt;FONT color="#000000"&gt;.create( groupID,&lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;SubTestGroup&amp;quot;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; );&#13;
&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/PRE&gt;ここで取得した&amp;quot;H5GroupId&amp;quot;クラスを&amp;quot;H5DataSetId&amp;quot;クラスの作成時に使用すれば、任意のグループ内にデータを作成することができる。グループを閉じる順序は、最後に開いたグループから順に閉じていく。&lt;BR&gt;&lt;BR&gt;以下、グループ作成を交えたサンプル&lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; width: 500px; height: 308px; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#0000ff"&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5FileId&lt;/SPAN&gt; fileID = &lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.create(&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;C:\\Test.hdf5&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt; , &lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.&lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;CreateMode&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.ACC_TRUNC );&lt;BR&gt;&lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5GroupId &lt;/SPAN&gt;&lt;FONT color="#000000"&gt;groupID = &lt;/FONT&gt;&lt;FONT color="#2b91af"&gt;H5G&lt;/FONT&gt;&lt;FONT color="#000000"&gt;.create( fileID,&lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;TestGroup&amp;quot;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; );&lt;BR&gt;&lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5GroupId &lt;FONT color="#000000"&gt;subG&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt;roupID = &lt;/FONT&gt;&lt;FONT color="#2b91af"&gt;H5G&lt;/FONT&gt;&lt;FONT color="#000000"&gt;.create( groupID,&lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;SubTestGroup&amp;quot;&lt;/SPAN&gt;&lt;FONT color="#000000"&gt; );&#13;
&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataSpaceId&lt;/SPAN&gt; spaceID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;.create_simple( &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: purple;"&gt;1&lt;/SPAN&gt;, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;long&lt;/SPAN&gt;[] { &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: purple;"&gt;1&lt;/SPAN&gt; } );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; typeID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.copy( &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5Type&lt;FONT color="#000000"&gt;.NATIVE_DOUBLE&lt;/FONT&gt;&lt;/SPAN&gt; );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; datasetID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.create( subGroupID, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;PI&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;, typeID, spaceID );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.write&amp;lt;&lt;FONT color="#0000ff"&gt;double&lt;/FONT&gt;&amp;gt;( datasetID, typeID, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;FONT color="#0000ff"&gt;double&lt;/FONT&gt;&amp;gt;( &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new double&lt;FONT color="#000000"&gt;[]{ &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: purple;"&gt;3.14152649&lt;/SPAN&gt; }&lt;/FONT&gt;&lt;/SPAN&gt; ) );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.close( datasetID );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.close( typeID ); &lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;.close( spaceID );&lt;BR&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5G&lt;/SPAN&gt;.close( subG&lt;FONT color="#000000"&gt;roupID&lt;/FONT&gt; );&lt;BR&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5G&lt;/SPAN&gt;.close( groupID );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.close( fileID );&lt;/PRE&gt; &lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5DotNet : 文字列の書き込み</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/08/6715143</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/08/6715143</guid>
      <pubDate>Fri, 08 Feb 2013 08:18:00 +0900</pubDate>
      <dcterms:modified>2013-02-09T21:04:34+09:00</dcterms:modified>
      <dcterms:created>2013-02-08T08:29:47+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line" aria-posinset="0" aria-setsize="0" aria-level="0"&gt;文字列の書き込み方法について&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;文字列を書き込む方法はちょっと特殊。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;基本は前回の&amp;quot;HDF5 : 値の追加&amp;quot;と同じ方法であるが、C#にある&amp;quot;string&amp;quot;型が使用できない。まずは、&amp;quot;string&amp;quot;型を&amp;quot;byte[]&amp;quot;型にして、&amp;quot;byte&amp;quot;型の配列にしてやる。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&amp;quot;string&amp;quot;型を&amp;quot;byte[]&amp;quot;型に変換するには&amp;quot;UTF8Encoding&amp;quot;クラスなどの&amp;quot;GetBytes&amp;quot;メソッドを使用する。&lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#0000ff"&gt;string &lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;stringValue =&lt;/FONT&gt; &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;This is TestString.&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;UTF8Encoding&lt;/SPAN&gt; uni = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new&lt;/SPAN&gt; System.Text.&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;UTF8Encoding&lt;/SPAN&gt;( );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;Byte&lt;/SPAN&gt;[] byteArray = uni.GetBytes( stringValue );&lt;/PRE&gt;まずはSpaceの作成。ここも少し特殊。書き込みは&amp;quot;byte[]&amp;quot;型であるが、文字列ひとつを一つの型と認識させるので、Spaceの定義は以下のようになる。 &lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataSpaceId&lt;/SPAN&gt; spaceID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;.create_simple( &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: purple;"&gt;1&lt;/SPAN&gt;, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;long&lt;/SPAN&gt;[] { &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: purple;"&gt;1&lt;/SPAN&gt; } );&#13;
&lt;/PRE&gt;続いて型の定義。基本通り&amp;quot;H5DataTypeId&amp;quot;を作成するが、上記に書いた通り、文字列を一つの型と認識させる必要がある。型の大きさを指定する場合は&amp;quot;H5T&amp;quot;クラスの&amp;quot;create&amp;quot;メソッドを使用する。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;引数は以下のように&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;　&amp;quot;createClass&amp;quot; : &amp;quot;H5T.CreateClass&amp;quot;列挙型を指定。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;　&amp;quot;size&amp;quot; : int型、型の大きさを指定する。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;文字列を書き込む場合は&amp;quot;H5T.CreateClass&amp;quot;列挙に&amp;quot;STRING&amp;quot;があるので、それを使用する。sizeは上記で取得したbyte[]の配列長さを指定する。型の定義は以下のようになる。&lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; width: 460px; height: 34px; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; typeID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.create(&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;CreateClass&lt;/SPAN&gt;.STRING,byteArray.Length );&lt;/PRE&gt;また、前回の型定義方法でも可能。&amp;quot;H5T&amp;quot;クラス&amp;quot;copy&amp;quot;メソッドで使用する型定義は&amp;quot;C_S1&amp;quot;の列挙型を指定する。定義後はサイズ指定をする必要がある。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;サイズを指定する場合は、&amp;quot;H5T&amp;quot;クラスの&amp;quot;setSize&amp;quot;メソッドを使用する。引数は以下の通り。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;　&amp;quot;typeId&amp;quot; : &amp;quot;H5DataTypeId&amp;quot;クラス、同じ&amp;quot;H5T&amp;quot;クラスのメソッド&amp;quot;copy&amp;quot;メソッドで作成した型情報を渡す。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;　&amp;quot;size&amp;quot; : &amp;quot;int型&amp;quot;、型のサイズを指定する。&lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; width: 459px; height: 39px; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; typeID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.copy( &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5Type&lt;/SPAN&gt;.C_S1 );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.setSize( typeID, byteArray.Length );&lt;/PRE&gt;後は、数値の書き込みと同じように、&amp;quot;H5DataSetId&amp;quot;を作成して、&amp;quot;H5D&amp;quot;クラスの&amp;quot;write&amp;lt;&amp;gt;&amp;quot;メソッドで書き込む。書き込む内容は上記で取得したbyte[]。&lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; datasetID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.create( fileID, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;Test&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;, typeID, spaceID );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.write&amp;lt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;byte&lt;/SPAN&gt;&amp;gt;( datasetID, typeID, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;byte&lt;/SPAN&gt;&amp;gt;( byteArray ) );&#13;
&lt;/PRE&gt;書き込み終了後は、各ID作成クラスにある&amp;quot;close&amp;quot;メソッドで後処理を行う。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;ちなみにこの方法で作成すると、HDFViewでlengthが固定になってしまう。HDFViewで編集することもできるが、lengthを超える値を保存しようとすると、超えた部分は保存されない。&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;以下、サンプルプログラム&lt;PRE aria-posinset="0" aria-setsize="0" aria-level="0" style="background: white; width: 476px; height: 296px; color: black; font-family: MS Gothic;"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#0000ff"&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5FileId&lt;/SPAN&gt; fileID = &lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.create(&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;C:\\Test.hdf5&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt; , &lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.&lt;/FONT&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;CreateMode&lt;/SPAN&gt;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;.ACC_TRUNC );&lt;/FONT&gt;&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;string &lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;stringValue =&lt;/FONT&gt; &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;This is TestString.&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;UTF8Encoding&lt;/SPAN&gt; uni = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new&lt;/SPAN&gt; System.Text.&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;UTF8Encoding&lt;/SPAN&gt;( );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;Byte&lt;/SPAN&gt;[] byteArray = uni.GetBytes( stringValue );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataSpaceId&lt;/SPAN&gt; spaceID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;.create_simple( &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: purple;"&gt;1&lt;/SPAN&gt;, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;long&lt;/SPAN&gt;[] { &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: purple;"&gt;1&lt;/SPAN&gt; } );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; typeID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.create( &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;CreateClass&lt;/SPAN&gt;.STRING, byteArray.Length );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; datasetID = &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.create( fileID, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(163, 21, 21);"&gt;&amp;quot;Test&amp;quot;&lt;FONT aria-posinset="0" aria-setsize="0" aria-level="0" color="#000000"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;, typeID, spaceID );&#13;
&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.write&amp;lt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;byte&lt;/SPAN&gt;&amp;gt;( datasetID, typeID, &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5Array&lt;/SPAN&gt;&amp;lt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: blue;"&gt;byte&lt;/SPAN&gt;&amp;gt;( byteArray ) );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.close( datasetID );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.close( typeID ); &lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;.close( spaceID );&lt;BR aria-posinset="0" aria-setsize="0" aria-level="0"&gt;&lt;SPAN aria-posinset="0" aria-setsize="0" aria-level="0" style="color: rgb(43, 145, 175);"&gt;H5F&lt;/SPAN&gt;.close( fileID );&lt;/PRE&gt;&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5DotNet : 値の追加</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/07/6714496</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/07/6714496</guid>
      <pubDate>Thu, 07 Feb 2013 12:13:58 +0900</pubDate>
      <dcterms:modified>2013-02-09T21:04:16+09:00</dcterms:modified>
      <dcterms:created>2013-02-07T12:19:56+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;値の追加方法&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;値を追加するにはいくつかの手順を踏む必要がある。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;1 : 占有スペースの定義作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;2 : 書き込む型の定義作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;3 : 占有スペースと型の定義を合わせた書き込み定義の作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;4 : データの作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;5 : 書き込み&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;6 : 各IDの処理&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;1 : 占有スペースの定義作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　ファイル内にデータを保存するためのスペースを決めるために作成する&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　スペース定義を作成するには、&amp;quot;H5S&lt;SPAN style="line-height: 1.7em;"&gt;&amp;quot;クラスにある&amp;quot;create_simple&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em;"&gt;”メソッドを使用する。引数は以下の通り&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　　&amp;quot;rank&amp;quot; : &amp;quot;int&amp;quot;型、配列の次元数を指定。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　　&amp;quot;dims&amp;quot; : &amp;quot;long[]&amp;quot;型、配列の大きさを指定する。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　戻り値は&amp;quot;H5DataSpaceId&amp;quot;クラス。使用後に同じクラス内の&amp;quot;close&amp;quot;メソッドで閉じる必要があるので、とっておく。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　サンプルとして、一つの値を書き込む場合は以下のようにする。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;PRE style="color: black; font-family: &amp;quot;MS Gothic&amp;quot;;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSpaceId&lt;/SPAN&gt; spaceID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5S&lt;/SPAN&gt;.create_simple( &lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt;, &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;long&lt;/SPAN&gt;[] { &lt;SPAN style="color: purple;"&gt;1&lt;/SPAN&gt; } );&lt;SPAN style="color: rgb(45, 45, 45); line-height: 1.7em; font-family: メイリオ, Meiryo, &amp;quot;ＭＳ Ｐゴシック&amp;quot;, &amp;quot;Hiragino Kaku Gothic Pro&amp;quot;, Osaka, Verdana, sans-selif; font-size: small;"&gt; &lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;2 : 書き込む型の定義作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　型情報を定義して、スペースの区切りを定義する&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　型を定義するには&amp;quot;H5T&amp;quot;クラスの&amp;quot;copy&amp;quot;メソッドを使用する。引数は&amp;quot;H5T.H5Type&amp;quot;の列挙より選択。色々な型がある。今回はint型なので&amp;quot;NATIVE_INT&amp;quot;を使用。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　戻り値は&amp;quot;H5DataTypeId&amp;quot;クラス、もちろん使用後に同じクラス内の&amp;quot;close&amp;quot;メソッドで閉じるなければならないのでとっておく。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　　以下、サンプル。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;PRE style="color: black; font-family: &amp;quot;MS Gothic&amp;quot;;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataTypeId&lt;/SPAN&gt; typeID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.copy( &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5T&lt;/SPAN&gt;.&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5Type&lt;/SPAN&gt;.NATIVE_INT );&#13;
&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;3 : 占有スペースと型の定義を合わせた書き込み定義の作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　上記1,2を使用して書き込み定義を作成する。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　定義には&amp;quot;H5D&amp;quot;クラスの&amp;quot;create&amp;quot;メソッドを使用する。引数は4つ&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　　&amp;quot;groupOrFileId&amp;quot; : &amp;quot;&lt;SPAN style="line-height: 1.7em;"&gt;H5FileOrGroupId”クラス、&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em;"&gt;H5FileIdかH5GroupIdを指定する。今回は前者を指定。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　　&amp;quot;dataSetName&amp;quot; : &amp;quot;string&amp;quot;型を指定、データの名前を指定する。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　　&amp;quot;dataTypeId&amp;quot; : &amp;quot;H5DataTypeId&amp;quot;クラスを指定。上記2を指定する。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　　&amp;quot;dataSpaceId&amp;quot; : &amp;quot;H5DataSpaceId&amp;quot;クラスを指定。上記１を指定する&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　戻り値は&amp;quot;H5DataSetId&amp;quot;クラス、書き込み時に必要なのでとっておく。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　以下、サンプル。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;PRE style="color: black; font-family: &amp;quot;MS Gothic&amp;quot;;"&gt;&lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5DataSetId&lt;/SPAN&gt; setID = &lt;SPAN style="color: rgb(43, 145, 175);"&gt;H5D&lt;/SPAN&gt;.create( fileID, &amp;quot;Index&amp;quot;,typeID,spaceID );&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;4 : データの作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　書き込みの関数にて、必要になる&amp;quot;H5Array&amp;lt;&amp;gt;&amp;quot;クラスを作成する。このクラスは見ての通りジェネリッククラスなので、書き込みするデータの型を指定する。サンプルはint型を使用。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　引数はジェネリック指定した型の配列なので、配列を用意する必要がある。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　配列は32次元まで指定できる。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;   以下、サンプル。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;PRE style="color: black; font-family: &amp;quot;MS Gothic&amp;quot;;"&gt;&lt;SPAN style="color: rgb(43, 145, 175); line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;H5Array&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.39px; white-space: normal;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: blue; line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.39px; white-space: normal;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em; font-size: 12px; white-space: normal;"&gt; data = &lt;/SPAN&gt;&lt;SPAN style="color: blue; line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em; font-size: 12px; white-space: normal;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: rgb(43, 145, 175); line-height: 20.39px; white-space: normal;"&gt;H5Array&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.39px; white-space: normal;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: blue; line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.39px; white-space: normal;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="color: blue; line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;new int&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.39px; white-space: normal;"&gt;[]{1}&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em; font-size: 12px; white-space: normal;"&gt; );&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;5 : 書き込み&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　ここまでできたなら、最後は&amp;quot;H5D&amp;quot;クラス内の”write&amp;lt;&amp;gt;”メソッドで書き込む。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　ジェネリックメソッドなので、使用する型を入れる(今回はint型)。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　引数は以下の通り。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　　&amp;quot;dataSetId&amp;quot; : &amp;quot;H5DataSetId&amp;quot;クラスを指定、上記3にて作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　　&amp;quot;memTypeId&amp;quot; : &amp;quot;H5TypeId&amp;quot;クラスを指定、上記2で作成したものを使用する&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　　&amp;quot;data&amp;quot; : &amp;quot;H5Array&amp;lt;&amp;gt;&amp;quot;クラスを指定&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　以下、サンプル。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;PRE style="color: black; font-family: &amp;quot;MS Gothic&amp;quot;;"&gt;&lt;SPAN style="color: rgb(43, 145, 175); line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;H5D&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;.write&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.39px; font-size: 12px; white-space: normal;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: blue; line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.39px; font-size: 12px; white-space: normal;"&gt;&amp;gt;(SetID,typeID,data)&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em; font-size: 12px; white-space: normal;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;6 : 各IDの処理&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　書き込みが終われば、IDを各クラスの&amp;quot;close&amp;quot;メソッドで閉じる。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;備考：&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　・数値型であれば、&amp;quot;int&amp;quot;型の部分を変えれば基本応用が利く。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　　その際は、型定義時の&amp;quot;&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em;"&gt;H5T.H5Type&amp;quot;列挙型を適切なものを選択する。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　　(&amp;quot;double&amp;quot;型なら&amp;quot;NATIVE_DOUBLE&amp;quot;とか)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;　・例外で、C#の&amp;quot;decimal&amp;quot;型につていは使用できないので注意。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;以下、今回のサンプル&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;///////////////////////////////////////////////////////////////////////////////////////////&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;H5FileId fileId =  H5F.create(&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;,H5F.CreateMode.ACC_CREAT );//    ファイル作成&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;DIV class="asahi_editor_line"&gt;//H5FileId fileId = H5F.open(&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;, H5F.OpenMode.ACC_RDWR);      //  ファイルオープン&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;H5DataSpaceId spaceID = H5S.create_simple(1,new long[]{1});//   スペース作成&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;H5DataTypeId typeID = H5T.copy(H5T.H5Type.NATIVE_INT);//    型作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;H5DataSetId setID = H5D.create(fileId,&amp;quot;Index&amp;quot;,typeID,spaceID);  //書き込み定義作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;H5Array&amp;lt;int&amp;gt; data = new H5Array&amp;lt;int&amp;gt;(new int[]{1});    //  データの作成&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;H5D.write&amp;lt;int&amp;gt;(setID, typeID, data);   //書き込み&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;//各IDを閉じる&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;H5D.close(setID);&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;H5T.close(typeID);&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;H5S.close(spaceID);&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;H5F.close(fileId); //   ファイルを閉じる &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;/////////////////////////////////////////////////////////////////////////////////////////// &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5DotNet : ファイルの作成と読み込み</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/06/6714210</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/06/6714210</guid>
      <pubDate>Wed, 06 Feb 2013 22:31:40 +0900</pubDate>
      <dcterms:modified>2013-02-09T21:04:01+09:00</dcterms:modified>
      <dcterms:created>2013-02-06T23:26:07+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;前回の導入を行えれば、VisualStudioで作成可能になる&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;まずは上部にusingで参照可能にする&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;FONT color="#0000ff"&gt;&lt;/FONT&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(0, 0, 255);"&gt;&lt;FONT color="#0000ff"&gt;&lt;/FONT&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(255, 0, 0);"&gt;&lt;FONT color="#0000ff"&gt;01 using System;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color="#0000ff"&gt;02 using System.Collections.Generic;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color="#0000ff"&gt;03 using System.Linq;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color="#0000ff"&gt;04 using System.Text;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color="#0000ff"&gt;05 using System.Threading.Tasks;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color="#0000ff"&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(255, 0, 0);"&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(255, 0, 0);"&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(255, 0, 0);"&gt;06 using HDF5DotNet;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#0000ff"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#0000ff"&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;ファイルを作成する場合は、”H5F”クラスの”create”メソッドを使用する。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;引数は”作成するファイル名”と&amp;quot;作成タイプ&amp;quot;、&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;ファイル名は適当に指定。”作成タイプ”は&amp;quot;H5F.CreateMode&amp;quot;の列挙から”ACC_CREAT&lt;SPAN style="line-height: 1.7em;"&gt;”を使用する。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;戻り値に&amp;quot;H5FileId”&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em;"&gt;が帰ってくる。これはファイルを閉じる際に使用するのでとっておく。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt; &lt;/SPAN&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(255, 0, 0); line-height: 1.7em;"&gt; H5FileId fileId =  H5F.create(&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;,H5F.CreateMode.ACC_CREAT );&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN class="asahi_editor_styling"&gt;&lt;DIV class="asahi_editor_line" style="color: rgb(45, 45, 45); line-height: 1.7em;"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;閉じる際は、とっておいた&amp;quot;H5FileId&amp;quot;を使用して、&amp;quot;H5F.close&amp;quot;メソッドを使用する&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line" style="color: rgb(45, 45, 45); line-height: 1.7em;"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;引数は&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&amp;quot;H5FileId&amp;quot;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line" style="color: rgb(45, 45, 45); line-height: 1.7em;"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(255, 0, 0);"&gt;H5F.close(fileId);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;これで空ののHDF5ファイルが作成できる。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;できたファイルを&amp;quot;HDFView&amp;quot;にて確認（画面左のツリーを確認してほしい）&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(0, 0, 255);"&gt;static void Main(string[] args)&lt;BR&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(255, 0, 0);"&gt;    H5FileId fileId =  H5F.create(&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;,H5F.CreateMode.ACC_CREAT );&lt;BR&gt;    H5F.close(fileId&lt;/SPAN&gt;&lt;SPAN style="color: rgb(0, 0, 255); line-height: 1.7em;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: rgb(255, 0, 0); line-height: 1.7em;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(0, 0, 255);"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(0, 0, 255);"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;読み込む際は&amp;quot;H5F&amp;quot;クラスの&amp;quot;open&amp;quot;メソッドを使用する。&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;引数は、開くファイル名と、&amp;quot;H5F.OpenMode&amp;quot;の列挙より選択。&amp;quot;ACC_RDONLY&lt;SPAN style="line-height: 1.7em;"&gt;&amp;quot;で読み込み専用、&amp;quot;ACC_RDWR&amp;quot;で書き込みもできる。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;戻り値は作成と同じく&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&amp;quot;H5FileId&amp;quot;なので、閉じるまでとっておく。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;ファイルを閉じる際は同じく&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&amp;quot;H5F.close&amp;quot;メソッドを使用&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 1.7em;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(0, 0, 255);"&gt;static void Main(string[] args)&lt;BR&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN class="asahi_editor_styling" style="color: rgb(255, 0, 0);"&gt;    H5FileId fileId =  H5F.open(&amp;quot;C:\\HDFSampleFile.hdf5&amp;quot;,H5F.OpenMode.ACC_RDONLY );&lt;BR&gt;    H5F.close(fileId&lt;/SPAN&gt;&lt;SPAN style="color: rgb(0, 0, 255); line-height: 1.7em;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: rgb(255, 0, 0); line-height: 1.7em;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(0, 0, 255);"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;次回は簡単な値の書き込み&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;
</description>
    </item>
    <item>
      <title>HDF5DotNet : VisualStudioでの導入</title>
      <link>http://memo-memo-and-memo.asablo.jp/blog/2013/02/05/6713398</link>
      <guid>http://memo-memo-and-memo.asablo.jp/blog/2013/02/05/6713398</guid>
      <pubDate>Tue, 05 Feb 2013 23:00:33 +0900</pubDate>
      <dcterms:modified>2013-02-09T21:03:44+09:00</dcterms:modified>
      <dcterms:created>2013-02-05T23:46:31+09:00</dcterms:created>
      <description>&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;仕事で導入する必要があったのでメモ&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;HDF5ファイルとは：&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;　&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif; font-size: 13.33px; background-color: rgb(255, 255, 255);"&gt;アメリカ国立スーパーコンピューティング応用センター(NCSA; National Center for Supercomputing Applications)が開発している、階層データフォーマット(Hierarchical Data Format)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif; font-size: 13.33px; background-color: rgb(255, 255, 255);"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif; font-size: 13.33px; background-color: rgb(255, 255, 255);"&gt;利点：&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif; font-size: 13.33px; background-color: rgb(255, 255, 255);"&gt;　数値、文字列、画像などをまとめて一つのファイルで保存できる。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif; font-size: 13.33px; background-color: rgb(255, 255, 255);"&gt;　保存は配列も可能、構造体での保存も可能、構造体の配列も可能&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif; font-size: 13.33px; background-color: rgb(255, 255, 255);"&gt;　内容ごとに圧縮も可能。容量を取らない。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif; font-size: 13.33px; background-color: rgb(255, 255, 255);"&gt;　HDFViewを使用すれば、簡単に内容を参照できる。値のコピーも可能、テキストファイルへの出力も可能、簡単なグラフの表示も可能など高機能&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif; font-size: 13.33px; background-color: rgb(255, 255, 255);"&gt;くわしいことは以下のリンク1で(全部英語)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 23.33px; background-color: rgb(255, 255, 255);"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;リンク1 : &lt;A href="http://www.hdfgroup.org/HDF5/whatishdf5.html" target="_blank"&gt;http://www.hdfgroup.org/HDF5/whatishdf5.html&lt;/A&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="line-height: 23.33px; background-color: rgb(255, 255, 255);"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;開発を.NetFramework環境で行うので、ラッパーDLLの”HDF5DoｔNet”というDLLを使用する。&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　詳細は以下のリンク2へ（英語です）&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;DIV class="asahi_editor_line"&gt;リンク2 : &lt;FONT color="#444444" face="Arial, Verdana, sans-serif" style="line-height: 1.2;"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif" style="line-height: 1.2;"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://hdf5.net/" target="_blank"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif" style="line-height: 1.2;"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;http://&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;hdf5.net/&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;ついでに、開発には。NetFramework4.0以降からなので、VisualStudio2012以降の開発環境でないとできないかも？&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;１：HDF5DotNetのバイナリダウンロード&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　&lt;/SPAN&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　a : リンク2のジャンプ先&amp;quot;&lt;/SPAN&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif" style="line-height: 1.7em;"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;Installation&amp;quot;の下”Pre-built HDF5DotNet assemblies can be found here”の下から環境にあったビルド済みのバイナリを含む書庫ファイルを取得。&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;　ついでにさらに下にある”HDF5DotNet source and examples&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;”からソースコードとサンプルがあるので、取得しておくと、参考になります。(この中にはC#ほか、C++、VB、Python（IronPython）のサンプルがあります。)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　b : ダウンロードしたバイナリ群をVisualStudioで作成するプロジェクト実行フォルダにコピーしておく。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　c : DLL”&lt;/SPAN&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;HDF5DotNet.dll&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;”をプロジェクトの参照に組み込んでおく。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　参照方法がわからないなどはググる。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;２：HDFViewのインストール&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　プログラムで作成したHDF5ファイルの確認に必要なのでインストール。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　また、HDFViewで簡単なグラフがかけたり、画像を追加したりできます。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　データの表示も表形式で表示されるので、内容をコピーして、Excelに張り付ければエクセルでの保存もできます。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　a : リンク1のジャンプ先ページの左側に”Downloads&amp;quot;の項目があるのでジャンプ。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　b : ジャンプ先のページの題名&lt;/SPAN&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;”&lt;/SPAN&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif" style="line-height: 1.2;"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;HDFView and HDF-Java Products&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;”の下にある”&lt;/SPAN&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;Current Release of HDFView&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;”をクリック&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　c : ジャンプ先のページ”&lt;/SPAN&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;Download HDFView 2.9&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;”の下くらいにプラットフォームが選べるので、選択してインストーラーをダウンロードする。（今回は32Bit-Distributionsからwindowsを選択）&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;SPAN style="color: rgb(68, 68, 68); line-height: 23.33px; font-family: Arial, Verdana, sans-serif;"&gt;　d : ダウンロードされたインストーラーを実行して、インストール。&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;　e : インストールされたプログラムを実行して確認してみる。&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="asahi_editor_line"&gt;&lt;FONT color="#444444" face="Arial, Verdana, sans-serif"&gt;&lt;SPAN style="line-height: 23.33px;"&gt;次回は、簡単なプログラムを記述予定。&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
</description>
    </item>
  </channel>
</rss>
