[Data Exchange Plugin] Export data (more than 4 columns)

[Data Exchange Plugin] Export data (more than 4 columns) - Problem exporting to CSV file - Сообщения

#1 Опубликовано: 29.03.2017 06:08:24
chandragon

chandragon

0 сообщений из 3 понравились пользователям.

Группа: User

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 !
#2 Опубликовано: 29.03.2017 07:48:02
Davide Carpi

Davide Carpi

1416 сообщений из 2873 понравились пользователям.

Группа: Moderator

Hello [userlink]chandragon[/userlink]

could you provide a file with an example that doesn't work for you, I'm not able to reproduce your issue


2017-03-30 13_41_43-C__Users_Davide Carpi_Desktop_test.csv - Notepad++.png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Опубликовано: 29.03.2017 12:58:37
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

For 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 Опубликовано: 31.03.2017 06:43:35
chandragon

chandragon

0 сообщений из 3 понравились пользователям.

Группа: User

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 КиБ) скачан 50 раз(а).
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:
matrix.png
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:
formula.png
#5 Опубликовано: 31.03.2017 07:53:00
chandragon

chandragon

0 сообщений из 3 понравились пользователям.

Группа: User

Problem solved using only one augment() call to create the matrix like Davide Carpi did!

Thanks again !
#6 Опубликовано: 31.03.2017 18:57:12
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

If 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 КиБ) скачан 67 раз(а).


... you can't remove the quotes "..."
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений