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 TheWizEd  
#1 Posted : 04 July 2010 23:42:54(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
First of all I'm new to SMath and I want to say how impressed I am with its capabilities. My company has subscribed to MathCAD and I've used if for about 4 years. I do all my engineeging calcs with MathCAD. However, the cost prohibits me from using it at home.

Now that I've found SMath I have an alternative.

I've been playing with the rfile wfile plug ins and finally figured out, in Windows 7 the files go to the directory C:\Users\****\AppData\Roaming\SMath\user. Where **** is the current user's name. Under previous versions of windows this used to be under "Documents and Settings" Any way the syntax is:

wfile(x,filexx)=1 will write a file in the above directory with the name "filexx". No quotes on the file name. You can't enter a quoted string for file name.

y:=rfile(filexx) will read back the file from the above directory with name "filexx"

For importData is goes like this:

z:=importData("c:\users\****\appdata\roaming\user\filexx",0,0,0,0,5,0,6,1)

This works for a comma delimited file with 5 rows and 6 columns and nonsymbolic data.

Somethings wrong with exportData it says "function is not defined".
Ed

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

Offline TheWizEd  
#2 Posted : 04 July 2010 23:59:04(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Opps importData didn't work. I inadvertantly read in data from a previous wfile.

For comma delimited i get an error message "Input string was not in a correct format.

By the way if I use importData to read a back a matrix I get a 5x6 matrix in a 1x1 matrix. I haven't figured out how to get rid of the outer matrix braces.
Ed
Offline Andrey Ivashov  
#3 Posted : 18 July 2010 02:46:29(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Hello and sorry for waiting.

wfile, rfile and dfile functions are not designed to work with importData function. SMath Studio will have two ways to work with external files: 1) importData and exportData (not implemented yet); 2) wfile, rfile and dfile. When exportData would be implemented, then wfile, rfile and dfile will be obsolete.

TheWizEd wrote:
For comma delimited i get an error message "Input string was not in a correct format.

This error appears because I didn't test this function with English settings of delimiters ('.' as Decimal Symbol and ',' as Arguments Separator) before 0.88 release (my fault) - with ','/';' you could see correct work of importData function. This error is fixed.

Regards, Andrey Ivashov.
Offline TheWizEd  
#4 Posted : 18 July 2010 16:57:22(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Andrey,

I've tried evey combination of delimeters I can think of. In the data file, in the importData function but no success. I tried to duplicate your example but get the same message.



Input file. Tabs are visible. Space character dots are barely visible.


Ed
Offline Andrey Ivashov  
#5 Posted : 18 July 2010 18:06:03(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
importData(..) created especially to handle Mathcad output data files, they have spaces or tabs as column delimiters and dots as decimal symbols. The final realization of this function like you can found in SMath Studio 0.88 was a bit changed for these purposes, so the screenshot from http://en.smath.info/for...t.aspx?g=posts&t=372 is obsolete now. In your test you need to specify the last argument of the importData function as 1 - which means that data is symbolic (Mathcad doesn't support such data export). Maybe separators should be specified also.

Here is updated pic.

Edited by user 18 July 2010 18:17:05(UTC)  | Reason: Not specified

Offline TheWizEd  
#6 Posted : 18 July 2010 19:28:27(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Andrey,

Success. I was able to duplicate the examples shown above.

Also I created a space delimited file with data and was able to read in the matrix with the importData(9) or importData(1) functions.

Thanks.

Edited by user 18 July 2010 19:31:18(UTC)  | Reason: Not specified

Ed
Offline TheWizEd  
#7 Posted : 18 July 2010 21:34:30(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Andrey,

I notice a peculiar behavior of importData. I'm not sure if it's what you intended.

The first import function produces the results shown. I then introduce a variable a. I then duplicate the import function. Then I went and edited the file test2.csv. I came back to SMath and changed the value of a. The second import statement now shows the new values from the file. Notice the lower right hand value in each matrix.

This exercise was intended to show that each time something above the import function is changed the import function reruns. Maybe not something you want to have done for speed and efficiency. Any way to prevent a function from rerunning?

Ed
Offline Andrey Ivashov  
#8 Posted : 18 July 2010 22:37:33(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
It is standard behavior of all math regions of the program. importData(..) function have no chance to save the data. After the data file is changed user should press F9 keyboard button itself to actualize the worksheet.

TheWizEd wrote:
Maybe not something you want to have done for speed and efficiency.

Actually this is by design. To prove the importance of such kind of SMath Studio behavior just imagine if your file will contain "a" parameter instead of last matrix item value. Then SMath Studio really needs to import the file first and try to substitute previously defined "a" into the matrix. Now imagine that you will change the value of "a" in definition (as you done in your exercise) - program should reevaluate the region(s) below to substitute "a" to the matrix again, but program have no initial matrix from file stored... it should be imported again. And of course SMath Studio has no idea if data from file contains any parameters or not - to check it program should repeat evaluation.
Hope I make it clear now Good

Regards, Andrey Ivashov.

Edited by user 19 July 2010 00:15:25(UTC)  | Reason: Not specified

Offline TheWizEd  
#9 Posted : 18 July 2010 23:06:10(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Okay. Now I understand.
Ed
Offline TomG  
#10 Posted : 26 November 2010 09:49:34(UTC)
TomG

Rank: Newbie

Groups: Registered
Joined: 26/11/2010(UTC)
Posts: 2
Location: New Mexico, USA

Hello,
I recently discovered SMath and thought I'd give it a try after using MathCad for the last 20+ years. I attempted to use the importData function as described by Andrey on July 18, 2010.

I created the data file and when I type importData("C:\Users\Tom\Desktop\data.txt"; ) I get an error as soon as I type in the semicolon ;. The error message says,
CriticalError
Count cannot be less than zero.
Parameter name: count
ControlCanNotBeDisplayed

I turned off the Dynamic Assistance thinking that may be the cause but I get the same error. Any idea what is going wrong?
I'm using SMath 0.89 on a computer running Win 7 Pro.
Thanks for your help,
Tom

Edited by user 26 November 2010 09:52:25(UTC)  | Reason: Not specified

Offline omorr  
#11 Posted : 26 November 2010 11:53:19(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello TomG and welcome Good
TomG wrote:
I created the data file and when I type importData("C:\Users\Tom\Desktop\data.txt"; ) I get an error as soon as I type in the semicolon ;. The error message says,
CriticalError
Count cannot be less than zero.
Parameter name: count
ControlCanNotBeDisplayed

I turned off the Dynamic Assistance thinking that may be the cause but I get the same error. Any idea what is going wrong?
I'm using SMath 0.89 on a computer running Win 7 Pro.

Yes, this was a known bug in v0.89 when you use different characters for function arguments then the one which is required. Please use the recent beta 0.89.8.
SMath is multiregional and multilingual oriented, and you have the option to change the characters for the decimal symbol and function arguments separator. Just check the Tools|Options|Interface and Decimal symbol and Arguments separator.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline TomG  
#12 Posted : 27 November 2010 01:24:57(UTC)
TomG

Rank: Newbie

Groups: Registered
Joined: 26/11/2010(UTC)
Posts: 2
Location: New Mexico, USA

Hi Radovan,
Thank you very much for the help. I was finally able to do the example as shown. Please keep up the good work.
Tom
Offline veb  
#13 Posted : 20 November 2019 15:44:00(UTC)
veb


Rank: Advanced Member

Groups: Registered
Joined: 02/02/2016(UTC)
Posts: 35
Man
Russian Federation

Was thanked: 1 time(s) in 1 post(s)
Hello
Help with Importdate (9)
I want to upload a matrix for the graph in smath. I use the format tsv. I use ";" as a separator. Decimal symbol ",".
2019-11-20_15-45-50.png

What am I doing wrong with import date (9)?

Why I export a matrix with two columns
And I import with one column?
What is the best way to use to import data?
Offline Davide Carpi  
#14 Posted : 20 November 2019 19:07:53(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: veb Go to Quoted Post
What am I doing wrong with import date (9)?


Hello,

for numerical import, the 2nd and 4th arguments are those you have to set.

importData is a general purpose import function, hence can import even SMath studio data; 2nd and 3rd are decimal symbol and arguments separator "of single entries" (like in SMath Studio settings), 4th argument is the column separator of CSV data.


2019-11-20 17_07_01-SMath Studio - [importData.sm_].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
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.