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 fernando_92  
#1 Posted : 19 December 2016 11:27:40(UTC)
fernando_92

Rank: Newbie

Groups: Registered
Joined: 19/12/2016(UTC)
Posts: 3
France

Hello,
As far as I know, Smath allow us to create user defined functions and to share them using the "plugins". Plugins can be created by programming the functions using a development tool.
But this solution is not practical enough when the functions are really complicated. (cf http://smath.info/wiki/G...plugin%20for%20Smath.pdf)

I would like to know how would it be possible to share some user defined functions or plugins without having to program.

For example, imagine I use "function1" in several Smath projects.
I want to be able to use this "function1" in all of my sheets without having to redefine "function1" in every project.

Please this would be very helpful for me.

Thank you for your suggestions.

Fernando

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

Offline uni  
#2 Posted : 19 December 2016 11:38:11(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
You can use include plugin for this.
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 19/12/2016(UTC)
Offline alyles  
#3 Posted : 19 December 2016 16:59:13(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 276
United States

Was thanked: 91 time(s) in 57 post(s)
I use snippets for this purpose.

For more info on snippets see the wiki here: http://smath.info/wiki/Snippets.ashx

Edited by user 19 December 2016 17:44:23(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
thanks 2 users thanked alyles for this useful post.
on 19/12/2016(UTC),  on 20/12/2016(UTC)
Offline Jean Giraud  
#4 Posted : 20 December 2016 03:59:30(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: fernando_92 Go to Quoted Post
For example, imagine I use "function1" in several Smath projects.
I want to be able to use this "function1" in all of my sheets without having to redefine "function1" in every project.


That's what the "plugin Include" does.
1. Plug these two in the same directory.
2. Open "Genfit Algo Include Test.sm"
3. It will ask to install "include Plugin", install.
4. Press F9 to calculate work sheet.

Please confirm if it works for you.
Was created Smath 5346, works fine latest Smath 6179.

Jean

Genfit Algo Include.sm (14kb) downloaded 17 time(s).

Genfit Algo Include Test.sm (17kb) downloaded 16 time(s).

thanks 1 user thanked Jean Giraud for this useful post.
on 20/12/2016(UTC)
Offline Jean Giraud  
#5 Posted : 20 December 2016 06:04:51(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
... try these two . Same topo as previous "Genfit"

Fourier 2D ZOOM Include.sm (12kb) downloaded 19 time(s).

Fourier 2D ZOOM Include Test.sm (106kb) downloaded 19 time(s).
Offline fernando_92  
#6 Posted : 20 December 2016 10:22:49(UTC)
fernando_92

Rank: Newbie

Groups: Registered
Joined: 19/12/2016(UTC)
Posts: 3
France

Hello, thank you for your suggestions, plugin " Include " works for me. It is really helpful. I will have to test its limits.
But I would like to know now what is the difference between Snippets and the "Include" Plugin ? Why couldn't we just use snippets?
Thank you!
Offline alyles  
#7 Posted : 20 December 2016 16:05:06(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 276
United States

Was thanked: 91 time(s) in 57 post(s)
Both Snippets and Include you have a "master" worksheet that includes all the functions you'd like to incorporate into the worksheet.

With Snippets, you actually create a copy of the "master" and essentially paste it into the worksheet that you are using. It puts the copied worksheet into a collapsible area so you can minimize it if you'd like.

Advantages and disadvantages to this approach are as follows.
1.) You have direct access to the function definitions. You can see how you wrote a certain function or make changes in your local copy but they don't get updated in the "master" snippet.
2.) If you update the "master" snippet worksheet, it does NOT update worksheets where the snippet as been used. You would have to re-add the snippet in subsequent worksheets to update.

With the Include plugin, you are essentially running the "master" worksheet in the background and you have access to the results and functions defined in that worksheet. This has the potential advantages/disadvantages of
1.) Cannot see or change the function definitions in the local worksheet.
2.) An update in the "master" worksheet will be immediately available to any worksheets that include the master.

I prefer snippets for managing functions a couple reasons.
1.) I like to have the local copy of the functions in the worksheet. I often make worksheets and don't come back to them for months or years at a time. When I do, I like to see the state of the functions that I used at that time. Everything I need is in one worksheet. If I were to use the include plugin and for any reason I lost or misplaced the master Include worksheet, I'd be SOL.
2.) I think I ran into the issue with the include plugin with which function Descriptions don't get passed from one worksheet to another. I often write a lot of detail on how some of my more complicated functions work so they can be useful to others or so I can remember how to use them properly. Using the include plugin, you'd have to go to the master worksheet to see that information

I find include plugin to be much more useful for transferring results. Perhaps I create a worksheet to solve for the output of a certain circuit. I then want to use the results of that for the input of another circuit. I may use the include plugin in that situation.

Edited by user 20 December 2016 16:53:11(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
thanks 1 user thanked alyles for this useful post.
on 20/12/2016(UTC)
Offline Jean Giraud  
#8 Posted : 20 December 2016 18:03:20(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Thanks for the ellaborate distinction.
"Snippets" is like a plugin, like something done for ever [so to speak].
I understand better how to manage "Include". Looks much easier to recompose
a stand alone work sheet to share in the forum.
Offline Jean Giraud  
#9 Posted : 20 December 2016 18:13:45(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: fernando_92 Go to Quoted Post
Hello, thank you for your suggestions, plugin " Include " works for me. It is really helpful. I will have to test its limits.
But I would like to know now what is the difference between Snippets and the "Include" Plugin ? Why couldn't we just use snippets?
Thank you!


Fernando:

Did the 2nd "Fourier" example work ?

It didn't work for me the first time. It couldn't find the Matlab "mwXXX.."
library. By luck I type 'mwbesselj(1,1.23456789) in new sheet. It did want
to install the 8 MB Matlab stuff, YES, done, then the Fourier is available.

Viacheslav replied: repaired.

Jean

Users browsing this topic
Guest
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.