how to use importData()

how to use importData() - Сообщения

#1 Опубликовано: 26.01.2022 13:01:16
Stefano

Stefano

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

Группа: User

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
#2 Опубликовано: 26.01.2022 15:57:30
overlord

overlord

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

Группа: Moderator

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
#3 Опубликовано: 26.01.2022 17:45:52
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

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 (305 КиБ) скачан 83 раз(а).
TEST.pdf (904 КиБ) скачан 104 раз(а).

Best regards
Alvaro.
#4 Опубликовано: 02.02.2022 08:20:59
Stefano

Stefano

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

Группа: User

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
#5 Опубликовано: 02.02.2022 13:03:58
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Wrote

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.
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений