1 Pages (6 items)
[Data Exchange Plugin] Export data (more than 4 columns) - Problem exporting to CSV file - Messages
#1 Posted: 3/29/2017 6:08:24 AM
Hi everyone !
I'm new to SMath Studio and find it really great, thanks a lot for this awesome tool !
But I came across a problem I don't find how to solve:
I want to export my data (a big matrix) to a csv file that would be arranged like this:
0.01,201060,237680,198853.285077439
0.015849,143256,185072,174269.293182435
0.025119,93978,149668,133006.974667634
0.03981,57338,110334,83471.8795836333
0.063095,35432,79992,43221.3253258427
0.1,20672,57000,19652.9918548953
0.15849,11280.4,40188,8399.57161545733
0.25119,6361.6,27224,3544.56326448012
.....
For that, I use a matrix to which I add the colums one by one and use the CVS/ODT plugin:
M:=augment(col1;col2)
M:=augment(M;col3)
M:=augment(M;col4)
.....
export_CSV(M,"filename")
And that works fine up to 4 columns... but for a reason I don't understand if I add more columns it ends up writing the file as:
"mat(0.01,201060,237680,198853.285077439,0.015849,143256,185072,174269.293182435,0.025119,93978,149668,133006.974667634......
Can you help me get the same file format with more columns ?
Thanks !
I'm new to SMath Studio and find it really great, thanks a lot for this awesome tool !
But I came across a problem I don't find how to solve:
I want to export my data (a big matrix) to a csv file that would be arranged like this:
0.01,201060,237680,198853.285077439
0.015849,143256,185072,174269.293182435
0.025119,93978,149668,133006.974667634
0.03981,57338,110334,83471.8795836333
0.063095,35432,79992,43221.3253258427
0.1,20672,57000,19652.9918548953
0.15849,11280.4,40188,8399.57161545733
0.25119,6361.6,27224,3544.56326448012
.....
For that, I use a matrix to which I add the colums one by one and use the CVS/ODT plugin:
M:=augment(col1;col2)
M:=augment(M;col3)
M:=augment(M;col4)
.....
export_CSV(M,"filename")
And that works fine up to 4 columns... but for a reason I don't understand if I add more columns it ends up writing the file as:
"mat(0.01,201060,237680,198853.285077439,0.015849,143256,185072,174269.293182435,0.025119,93978,149668,133006.974667634......
Can you help me get the same file format with more columns ?
Thanks !
#2 Posted: 3/29/2017 7:48:02 AM
#3 Posted: 3/29/2017 12:58:37 PM
WroteFor that, I use a matrix to which I add the columns one by one
Give some hint about your matrix:
1. created in Smath as an 2D image ?
2. columns from foreign source or from Smath modules ?
If foreign from source as individual columns
easy to augment via a little piece of program.
Jean
#4 Posted: 3/31/2017 6:43:35 AM
Hi and thanks for your answers.
Giving you the .sm file would be complicated because of the plenty of files it opens...
But here is the output file I get:
mydata.7z (4 KiB) downloaded 50 time(s).
If I remove the " " and try to read it with rfile it gives the value 0.
The matrix I write is pretty big but here is what it looks like when I want to show it:

The number of lines matches.
It is created via a succession of augment() of columns made of real and imaginary parts of complex arrays that are created line by line in a for loop, example for one of them here:

Giving you the .sm file would be complicated because of the plenty of files it opens...
But here is the output file I get:
mydata.7z (4 KiB) downloaded 50 time(s).
If I remove the " " and try to read it with rfile it gives the value 0.
The matrix I write is pretty big but here is what it looks like when I want to show it:
The number of lines matches.
It is created via a succession of augment() of columns made of real and imaginary parts of complex arrays that are created line by line in a for loop, example for one of them here:
#5 Posted: 3/31/2017 7:53:00 AM
Problem solved using only one augment() call to create the matrix like Davide Carpi did!
Thanks again !
Thanks again !
#6 Posted: 3/31/2017 6:57:12 PM
WroteIf I remove the " " and try to read it with rfile it gives the value 0.
Your collection is not a matrix; it is an MDA [Multi Dimensional Array => Matlab]
or a CELL ARRAY [Mathematica]. No matter, the "collection" can be spooled to file
and recalled from file, just do it the right way as exemplified [attached].
Jean
File Create.sm (24 KiB) downloaded 67 time(s).
... you can't remove the quotes "..."
1 Pages (6 items)
-
New Posts
-
No New Posts