LoginSignup
4
2

More than 5 years have passed since last update.

julia メモ

Last updated at Posted at 2015-10-02

tutorial

http://samuelcolvin.github.io/JuliaByExample/
http://quant-econ.net/jl/learning_julia.html
https://en.wikibooks.org/wiki/Introducing_Julia
http://samuelcolvin.github.io/JuliaByExample/
http://learnxinyminutes.com/docs/julia/
https://github.com/chrisvoncsefalvay/learn-julia-the-hard-way

read
open("file_name") do f
    for line in eachline(f)
        print(line)
    end
end
read2_指定文字列の存在する行を抜き出す.
name="hogefuga" # 指定文字
f=readall("file_name")
dat=matchall(Regex("$name"".*"),f)
read3_データを行列に格納
f = open("file_name")
dat=readdlm(f)
read4_matchした行があったらループを終了
lines = open( "file_name", "r" ) do fp
    dat=readlines( fp )
    n=0
    for line in dat
        n+=1
        if( ismatch(r"$name", line)) 
            n+=1
            break
        end
    end
end

write
open("output.txt", "w") do f
    for n = 0:9
        write(f, string(n)"\n")
    end
end
中身のサイズが不明な配列(5個)を,配列の各要素に持たせる.
d=Array(Array,5)
行列の演算
A.*B        # 要素ごとの積
A.^B        # 要素ごとにB乗する.
dot(A,B)    # 内積
A'         # 転置
式展開
"$a"
4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2