如何从列表中删除逗号和括号 ( hmatrix )

How to remove commas and brackets from a list ( hmatrix )

用于在 gnuplot 中绘制图形

我正在尝试将此矩阵打印到文件中,但要将其执行到 gnuplot 中,我需要创建一个没有逗号和括号的文件,我该怎么做?

*install hmatrix
*install hmatrix-special
*import Numeric.LinearAlgebra

(5><2)
 [   0.12130139101653795, -3.9532277879855915e-2
 , -9.943512129289413e-2, -1.8736674261187188e-2
 ,   0.21650870755682688,  -7.774998273846949e-3
 ,  -0.19540767578866855,  -4.889335919164774e-2
 , -4.296730149180415e-2,    0.11493730960653939 ]

这将打印出每行各占一行的矩阵:

{-# LANGUAGE NoMonomorphismRestriction #-}

import Numeric.LinearAlgebra

m :: Matrix Double
m = (5><2)
 [   0.12130139101653795, -3.9532277879855915e-2
 , -9.943512129289413e-2, -1.8736674261187188e-2
 ,   0.21650870755682688,  -7.774998273846949e-3
 ,  -0.19540767578866855,  -4.889335919164774e-2
 , -4.296730149180415e-2,    0.11493730960653939 ]

printMatrix m = do
  putStrLn $ unlines $ map (unwords . map show . toList )  (toRows m)

test = printMatrix m