Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline chandragon  
#1 Posted : 29 March 2017 12:08:24(UTC)
chandragon

Rank: Newbie

Groups: Registered
Joined: 29/03/2017(UTC)
Posts: 3
France

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"Wink

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 !

Edited by user 31 March 2017 13:53:22(UTC)  | Reason: Not specified

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Davide Carpi  
#2 Posted : 29 March 2017 13:48:02(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Hello chandragon Offline

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

Edited by user 30 March 2017 19:39:07(UTC)  | Reason: fixed image

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Jean Giraud  
#3 Posted : 29 March 2017 18:58:37(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: chandragon Go to Quoted Post
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

Offline chandragon  
#4 Posted : 31 March 2017 12:43:35(UTC)
chandragon

Rank: Newbie

Groups: Registered
Joined: 29/03/2017(UTC)
Posts: 3
France

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 (5kb) downloaded 35 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:
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
Offline chandragon  
#5 Posted : 31 March 2017 13:53:00(UTC)
chandragon

Rank: Newbie

Groups: Registered
Joined: 29/03/2017(UTC)
Posts: 3
France

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

Thanks again !
Offline Jean Giraud  
#6 Posted : 01 April 2017 00:57:12(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: chandragon Go to Quoted Post
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 (25kb) downloaded 49 time(s).


... you can't remove the quotes "..."
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.