Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline kompre  
#1 Posted : 26 January 2022 19:01:16(UTC)
kompre


Rank: Member

Groups: Registered
Joined: 05/08/2021(UTC)
Posts: 22
Italy

Hi,

I have some trouble understanding how to use importData() function.

I get these type of errors:

  • "file does not exist" if I try a relative path
  • "input string is not in a correct format" if I try a absolute path


I am at loss, I don't understand what is not working
2022-01-26 16_59_22-Window.png

on win10
smath studio version 0.99 vuild 7921
Offline overlord  
#2 Posted : 26 January 2022 21:57:30(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 829
Turkey

Was thanked: 290 time(s) in 204 post(s)
DocumentDirectory() can be used for getting path of file.
If there are texts in your document, they need to be in quotes.
And arguments are depending on how they are written on file.
If you could provide your csv file, it would be more helpful to find correct ones.

Regards

2022-01-26_21-57.png

Edited by user 26 January 2022 22:54:40(UTC)  | Reason: Not specified

Offline Razonar  
#3 Posted : 26 January 2022 23:45:52(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,012
Uruguay

Was thanked: 560 time(s) in 364 post(s)
Hi. The attached shows that overlord's it's the best solution, but also that there are an issue somewhere, its cause is very hidden to me.

TEST.sm (306kb) downloaded 23 time(s).
TEST.pdf (905kb) downloaded 36 time(s).

Best regards
Alvaro.
Offline kompre  
#4 Posted : 02 February 2022 14:20:59(UTC)
kompre


Rank: Member

Groups: Registered
Joined: 05/08/2021(UTC)
Posts: 22
Italy

Ah I almost got it!

Some notes:


  • I was confused by the function "DocumentDirectory()" since it is part of the Mathcad Toolbox plugin, which I didn't have in my installation (thanks to Razonar for the sm file)

  • I still don't understand what is "Arguments Separator ("3: delimiter" )" meant for since the columns separator is defined in the 4th parameter; could functions being imported from the csv? (e.g. "...,foo(x;y),..." )



In the end the culprit was not the file path, which was ok, but the content of csv itself: the string where not enclosed in double quotes and there where also some whitespaces. The error message I got was unclear because it spoked about the "input string" being in the wrong format and I mistakenly thought it referred to the file's path passed to the function.

After properly formatting the csv file, I was able to correctly import in my sheet.

Thanks you

Edit: damn emoji

Edited by user 02 February 2022 14:22:59(UTC)  | Reason: Not specified

Offline Razonar  
#5 Posted : 02 February 2022 19:03:58(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,012
Uruguay

Was thanked: 560 time(s) in 364 post(s)
Originally Posted by: kompre Go to Quoted Post
Ah I almost got it!

Some notes: ...

I still don't understand what is "Arguments Separator ("3: delimiter" )" meant for since the columns separator is defined in the 4th parameter; could functions being imported from the csv? (e.g. "...,foo(x;y),..." )


From the "Interactive SMath Handbook" (In the SMath menu: Tools / Plugins / Interactive books):

(string or 0) argument separator character in the file, relevant for symbolic expressions. 0: use default setting

This is the 'argument separator', which could be set at Tools / Options as period, colon or semicolon.

In other words: useful if you want to import / export symbolic expressions with two or more arguments, like atan(y,x) or atan(y;x)

Best regards.
Alvaro.

Edited by user 02 February 2022 19:10:31(UTC)  | Reason: Not specified

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.