1 страниц (14 вхождений)
importData and exportData - Сообщения
#1 Опубликовано: 04.07.2010 16:42:54
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".
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
#2 Опубликовано: 04.07.2010 16:59:04
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.
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
#3 Опубликовано: 17.07.2010 19:46:29
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.
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.
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.
WroteFor 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.
#4 Опубликовано: 18.07.2010 09:57:22
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.

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
#5 Опубликовано: 18.07.2010 11:06:03
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/forum/default.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.

Here is updated pic.
#6 Опубликовано: 18.07.2010 12:28:27
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.
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.
Ed
#7 Опубликовано: 18.07.2010 14:34:30
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?

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
#8 Опубликовано: 18.07.2010 15:37:33
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.
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
Regards, Andrey Ivashov.
WroteMaybe 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

Regards, Andrey Ivashov.
#9 Опубликовано: 18.07.2010 16:06:10
Okay. Now I understand.
Ed
#10 Опубликовано: 26.11.2010 03:49:34
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
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
#11 Опубликовано: 26.11.2010 05:53:19
Hello TomG and welcome
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

WroteI 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!"
#12 Опубликовано: 26.11.2010 19:24:57
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
Thank you very much for the help. I was finally able to do the example as shown. Please keep up the good work.
Tom
#13 Опубликовано: 20.11.2019 09:44:00
#14 Опубликовано: 20.11.2019 13:07:53
WroteWhat 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.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 страниц (14 вхождений)
-
Новые сообщения
-
Нет новых сообщений