Writing to data files with an arbitrary extension

Writing to data files with an arbitrary extension - SMath feature to write data files with an arbitrary extension and possible workarounds. - Сообщения

#1 Опубликовано: 02.08.2016 13:02:27
marcofk

marcofk

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

Группа: User

Hello all. It's been a while since I last posted, but I've still been using SMath extensively and recommended it to all my colleagues.

I've got a new question:

Currently I'm having to use "fwrite" to produce an output file, but even if I name it with an extension different from .txt, it will ignore the extension I give in the filename and write a .txt.

There are some preset option with the different export functions but if I want to create a file with, say, a .myfile extension I have to create a .txt file and then use good old .bat scripts, which, although not too complex to implement, is a rather clunky and not very user-friendly way to solve the problem.

Is there a way to write files with an arbitrary extension? Or is there any way to run a windows script (e.g. the .bat file) from within SMath or SMath viewer? Does the script region work with this?

Any suggestions?

Thanks everyone.
#2 Опубликовано: 02.08.2016 14:57:41
Davide Carpi

Davide Carpi

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

Группа: Moderator

Hello marcofk,

You can run any format supported by your OS using the hyperlink region.

As for fwrite I can provide an improvement to not force the "txt" extension
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 пользователям понравился этот пост
marcofk 03.08.2016 08:24:00
#3 Опубликовано: 02.08.2016 15:12:32
Jean Giraud

Jean Giraud

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

Группа: User

I'm sure I don't understand your question. Maybe because there nothing to understand.
Smath saves in its own style, i.e: nothing to specify because it saves in its own
"mat2sys" style. Nothing universal like Mathcad read/write [*.prn, *.dat, *.txt ...].
As you open this work sheet, it will creates the appropriate directory, save what
you want [very usefull to collect model functions c/w parameters].
All that said is about Smath 5346, like Mathematica 4.0 who considered the world
was empty. File format like this or like that is one thing. The truth about data
saving is that the universal file format since long time is *.dat ...
in the worst case Excel.
Example: near where you live in UK, there is the sole world wide "climate laboratory".
This lab "HadCRU" [Hadley Climate Research Unit] saves data in *.dat, so that anybody
in the world can read.

Smath of latest version may have extra write/read options.

Jean

File Create.sm (24 КиБ) скачан 64 раз(а).

#4 Опубликовано: 03.08.2016 08:27:46
marcofk

marcofk

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

Группа: User

Wrote

Hello marcofk,

You can run any format supported by your OS using the hyperlink region.

As for fwrite I can provide an improvement to not force the "txt" extension



Davide,

thanks for the reply. In principle, an improved fwrite command will do the trick.

Cheers,

Marco
#5 Опубликовано: 15.08.2016 19:20:44
Davide Carpi

Davide Carpi

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

Группа: Moderator

Updated, you can try the plugin using the latest nightly build
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 пользователям понравился этот пост
marcofk 16.08.2016 08:57:00
#6 Опубликовано: 16.08.2016 09:04:35
marcofk

marcofk

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

Группа: User

Hi Davide,

not sure if my previous message came through when I sent it with "Quick reply", so I'll post it again:

I've tried your update and it now saves files with an arbitrary extension, and that's good enough for me in my application. Thanks very much for that.

However, I've noticed that control characters like e.g. {\n} - which should cause the following text to be written in a new line - are now written to the file as text, i.e. as I typed in the example.

The joys of debugging, eh?

Cheers,

Marco
1 пользователям понравился этот пост
Davide Carpi 16.08.2016 12:10:00
#7 Опубликовано: 16.08.2016 12:10:45
Davide Carpi

Davide Carpi

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

Группа: Moderator

Thank you Marco

totally my fault, fixed & updated
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 пользователям понравился этот пост
marcofk 17.08.2016 05:05:00
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений