1 / 9

10進ベーシックファイル入出力

10進ベーシックファイル入出力. この10組のデータで構成される csvファイル を扱う データは縦に並んでいるほうが扱いやすい. エクセル表記. 実際はこんな感じ. X Y. 1,2 2,4 3,6 4,8 5,10 6,12 7,14 8,16 9,18 10,20. このデータを,変数 x(i) と y(i) として読み込む それぞれを2倍して別のファイルとして保存する. test.csv →test2.csv. test.csv. x(i) y(i). 準備段階として変数の データ数を指定する

kami
Download Presentation

10進ベーシックファイル入出力

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 10進ベーシックファイル入出力

  2. この10組のデータで構成されるcsvファイルを扱うデータは縦に並んでいるほうが扱いやすいこの10組のデータで構成されるcsvファイルを扱うデータは縦に並んでいるほうが扱いやすい エクセル表記 実際はこんな感じ XY 1,22,43,64,85,106,127,148,169,1810,20

  3. このデータを,変数x(i)とy(i)として読み込むそれぞれを2倍して別のファイルとして保存するこのデータを,変数x(i)とy(i)として読み込むそれぞれを2倍して別のファイルとして保存する test.csv →test2.csv test.csv x(i)y(i) 準備段階として変数のデータ数を指定する dim x(10),y(10),xx(10),yy(10) これらは計算で使う

  4. もっともシンプルなファイル入力法 open #1 : name test.csv, ACCESS INPUT for i=1 to 10!10組のデータ input #1 :x(i),y(i)!2つの変数 next i close #1

  5. 変数x(i),y(i)を2倍する for i=1 to 10!10組のデータ xx(i)=2*x(i) yy(i)=2*y(i) next i

  6. もっともシンプルなファイル出力法 open #1 : name test2.csv, ACCESS OUTPUT for i=1 to 10!10組のデータ write #1 :xx(i),yy(i)!2つの変数 next i close #1

  7. 計算後に注釈行を付け加える test2.csv test.csv

  8. まとめると dim x(10),y(10),xx(10),yy(10)open #1 : name test.csv, ACCESS INPUTfor i=1 to 10!10組のデータinput #1 :x(i),y(i)!2つの変数next iclose #1for i=1 to 10!10組のデータxx(i)=2*x(i)yy(i)=2*y(i)next iopen #1 : name test2.csv, ACCESS OUTPUTfor i=1 to 10!10組のデータwrite #1 :xx(i),yy(i)!2つの変数next iclose #1 ファイル入力 計算 ファイル出力

  9. より実用的なファイル指定法 コンピュータdendriteのEドライブのハードディスク内のファイル(test.csv)にアクセス j$=“test” LET k$="\\Dendrite\E\shibata\エクセル\11月試験片\断面形状計算値\6.0\1\"&j$&".csv" open #1 : name k$, ACCESS INPUT ファイル出力も同様の方法でできる

More Related