Table Generator

Table Generator - running/recording an SMath sheet multiple times - Messages

#1 Posted: 3/28/2016 1:51:49 PM
Kemili

Kemili

1 likes in 10 posts.

Group: User

Can I get a point in the right direction, because I’m lost and a bit overwhelmed with the tons of info that is the internet.

I need the ability to change the “input” variables in an SMath sheet, and then grab/record the “output” variables, and then do that again and again and again. I’m essentially trying to create a generator for my “outputs” for potentially hundreds of pre-selected “input” combinations, using the calculations of an SMath sheet, to save time mostly.

I have created this ability in Excel, using its VBA, and am hopeful that this is somehow possible for SMath sheets.
I have also managed to successfully create the "combin" plugin with VB, so I am at least familiar with if that's a route I would need.



Please let me know if I need to clarify anything.
#2 Posted: 3/28/2016 3:51:26 PM
Ernesto

Ernesto

13 likes in 74 posts.

Group: User

It really depends what you are trying to do, and how you group your data. One way is to import your data from excel, or csv file, and group your data as a matrix, with each column being a separate data set. Once the data is in Smath, you can create formulas in a loop, with each data set being processed in each loop. Then export to excel or csv file.
#3 Posted: 3/28/2016 5:04:33 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote

Please let me know if I need to clarify anything.



Would love to help, but unsure of your initial goal - please elaborate on procedure.

Something tells me you could benefit from using spreadsheet interaction here, but again - not quite sure what would you like to do
#4 Posted: 3/28/2016 5:42:27 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

The data table can be any size, search any rows/any col.
Just modify/adapt to your project.

Jean

Forum ListCollect.gif
#5 Posted: 3/30/2016 1:11:12 PM
Kemili

Kemili

1 likes in 10 posts.

Group: User

Thank you for the responses. Please bare with me if you'd still like to help, I'm having trouble explaining what I'm wanting.

Wrote

Once the data is in Smath, you can create formulas in a loop, with each data set being processed in each loop. Then export to excel or csv file.



I have SMath sheets that run a bunch of calculations to come up with outputs at the end. Each sheet is essentially one big tool for getting these values at the end (to avoid doing it all by hand every time). What my goal would be is to run the entire sheet for those outputs with each data set of inputs. Are you saying that I can place a loop somewhere in the sheet to have the entire sheet run with each input data set while also collecting the outputs of each loop cycle? I ask because it is my understanding that SMath runs a sheet "in order", so placing a loop anywhere on the sheet meant to run the rest of the sheet a number of times would be exactly what i am looking for (hopefully not having to enclose the entire sheet in that loop).


Wrote


Would love to help, but unsure of your initial goal - please elaborate on procedure.
Something tells me you could benefit from using spreadsheet interaction here, but again - not quite sure what would you like to do



Hopefully my response to the above clears a bit.
Spreadsheet Interaction? It sounds promising. Can you point me to where I can read up on that? Unless you mean outright just working with a spreadsheet alongside SMath. I think that may be actually the way I would go.
#6 Posted: 3/30/2016 2:13:49 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote

Thank you for the responses. Please bare with me if you'd still like to help, I'm having trouble explaining what I'm wanting.

Wrote

Once the data is in Smath, you can create formulas in a loop, with each data set being processed in each loop. Then export to excel or csv file.



I have SMath sheets that run a bunch of calculations to come up with outputs at the end. Each sheet is essentially one big tool for getting these values at the end (to avoid doing it all by hand every time). What my goal would be is to run the entire sheet for those outputs with each data set of inputs. Are you saying that I can place a loop somewhere in the sheet to have the entire sheet run with each input data set while also collecting the outputs of each loop cycle? I ask because it is my understanding that SMath runs a sheet "in order", so placing a loop anywhere on the sheet meant to run the rest of the sheet a number of times would be exactly what i am looking for (hopefully not having to enclose the entire sheet in that loop).


Wrote


Would love to help, but unsure of your initial goal - please elaborate on procedure.
Something tells me you could benefit from using spreadsheet interaction here, but again - not quite sure what would you like to do



Hopefully my response to the above clears a bit.
Spreadsheet Interaction? It sounds promising. Can you point me to where I can read up on that? Unless you mean outright just working with a spreadsheet alongside SMath. I think that may be actually the way I would go.



From the sounds of it I have done, at some point, exactly what you would like to do. I will get back to you when I am off work. Btw where are you from? When I read "under the rock" first thing that comes to mind is rocky mountain house haha
#7 Posted: 3/30/2016 2:32:11 PM
Kemili

Kemili

1 likes in 10 posts.

Group: User

Wrote

From the sounds of it I have done, at some point, exactly what you would like to do. I will get back to you when I am off work. Btw where are you from? When I read "under the rock" first thing that comes to mind is rocky mountain house haha



Haha, no unfortunately not, though I'm actually from Edmonton, so it's very close. I'm simply from under a rock because there are a lot of things I don't know.
Thank you very much for offering your help. I look forward to your response. (:

#8 Posted: 3/30/2016 8:28:20 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote

Wrote

From the sounds of it I have done, at some point, exactly what you would like to do. I will get back to you when I am off work. Btw where are you from? When I read "under the rock" first thing that comes to mind is rocky mountain house haha



Haha, no unfortunately not, though I'm actually from Edmonton, so it's very close. I'm simply from under a rock because there are a lot of things I don't know.
Thank you very much for offering your help. I look forward to your response. (:



Kemili,

Attached is a file that should help you with your task.

1st part of the .sm workbook goes over creation of the function based on a sample procedure. Function will take input and provide output.

2nd pat of the worksheet will write the resulting output to an excel file.

If you do not have EXCEL installed you will need to use XLSX Import/Export plugin instead of EXCEL I/O. The benefit of using XLSX Import/Export is that it does not require MS EXCEL software; one of the drawbacks is that it does not let you to add data to existing EXCEL worksheet and overwrites it completely instead.

P.S.: Small world - it just happened that I live in Edmonton as well. If at some point you will get a long list of burning questions related to SMath Studio I would not refuse to meet for a cup of coffee ;-)

File not found.File not found.
#9 Posted: 3/30/2016 9:40:59 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Can I get a point in the right direction, because I’m lost and a bit overwhelmed with the tons of info that is the internet.

I need the ability to change the “input” variables in an SMath sheet, and then grab/record the “output” variables, and then do that again and again and again. I’m essentially trying to create a generator for my “outputs” for potentially hundreds of pre-selected “input” combinations, using the calculations of an SMath sheet, to save time mostly.



That does not induce my understanding, No example.
If you collect data calculated in Smath, then stay in Smath,
that's why an example is necessary.

Jean


#10 Posted: 3/30/2016 10:58:36 PM
Kemili

Kemili

1 likes in 10 posts.

Group: User

Wrote


That does not induce my understanding, No example.
If you collect data calculated in Smath, then stay in Smath,
that's why an example is necessary.



I am somewhat new to SMath (I've been aware of it for a couple years now, but only just started tinkering in it) and have not the capability at this time to produce an example. ): I'm still trying to wrap my head around a bunch of things about this program. And I do apologize, your earlier post had me more confused than before, but I know once I learn more I will go back to it. (:




Alex,
Thank you for your files. I'm currently deciphering them, and learning more! Once I get either really stuck or if I am able to reach my goal, I will post again. (:



:d
#11 Posted: 3/30/2016 11:25:49 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote

I'm currently deciphering them, and learning more! Once I get either really stuck or if I am able to reach my goal, I will post again. (:



:d



When in doubt, copy/paste to notepad! This is how I learned alot of Smath syntax from existing examples
#12 Posted: 4/8/2016 6:54:21 PM
Kemili

Kemili

1 likes in 10 posts.

Group: User

Alright, I got stuck... But I can almost see my goal in sight.

I now understand functions, importing/exporting data to excel, and the include plugin.

Though I believe I could technically use these to do what I need, it would require severe rewriting of the long (20+ unhidden pages each) SMath sheets I have, that currently double as a "user's guide" to see/evaluate the flow of how/what is being calculated (so it has kindof a display format, instead of "code" ).

That aside as a project in of itself, I am searching for a quicker solution that may let me use my current SMath sheets as they are, or with minimal editing.

With that, I am seeking a way to use an SMath sheet as a function itself - where I can insert a large matrix of input sets obtained from an excel/text file, and I would get a result matrix of associated outputs exported into another excel/text file.

There is a "Script Region" plugin on this site that allows insertion of script in cpp/VB/Python, to which I've managed to at least set up, and have figured out one or two things about it. Can this work to change the values of select-variables on the sheet, and recalculate said sheet in multiple iterations? While also recording the resulting values due to the changes, on each run?


Please and thank you,
#13 Posted: 4/8/2016 7:45:27 PM
Ernesto

Ernesto

13 likes in 74 posts.

Group: User

Quote

Can this work to change the values of select-variables on the sheet, and recalculate said sheet in multiple iterations?



Isn't this the data you would be importing from excel? It's difficult to give more specific answers without an example.
#14 Posted: 4/11/2016 3:12:52 PM
Kemili

Kemili

1 likes in 10 posts.

Group: User

File not found.File not found.File not found.

Alrighty, I've managed to pull together an example of what I'm looking for.

It uses the "Script Region" plugin. My questions are in that script region.

But if this plugin doesn't have the ability to do what I'd like, I wonder if simply going through my questions will spark an idea of another way to do what I want? Or if someone knows in which direction I should go? (:




Please and thank you, :d
#15 Posted: 4/12/2016 1:03:12 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

"The sheet currently doesn't work with this matrix at all. I want to be able to
use each set(row) of inputs from this matrix without converting the entire sheet
into a function"

Where is "Under a rock" ? Ah ! that's where your matrix is.

Something weird. Could it be that you have to just read from file, from foreign file
than Smath itself. As it looks importData.XLSX is just an instruction where to find
outside of Smath. You may need an instruction to "read" and have it in hand in Smath

myArray:=rfile(importData.XLSX("C:\SMath Testing\inputs.xlsx","Sheet1","A3","B11"))

Not too expensive to try

Within Smath itself works so nice

CWD:=CurrentDirectory("C:\SmathFile")
wfile(p,CWD,"Bézier")
rData:=rfile(CWD,"Bézier")

As a byside question, did you create the Excel data table form a math function?
Is it an import from JoBlo ? or from some Excel archive older than your Smath ?

In the worst case, you can copy the Excel table in "BLOC" into NotePad and paste
individually each NotePad entry into the Smath image matrix. Can't help more,
I didn't touch Excel since 2000, when I got Mathcad 8.

Jean


#16 Posted: 4/12/2016 2:06:40 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Sorry Collab from "Under a rock".
I tried every possible torture, not to avail.
I think it is a non confessed bug .

Cheers, Jean.
#17 Posted: 4/12/2016 11:46:17 AM
Kemili

Kemili

1 likes in 10 posts.

Group: User

Jean,
I meant that the sheet isn't using the matrix. I've already gotten the matrix imported just fine into the sheet. The sheet works fine also, but I need a way to programmatically run the sheet for the outputs for every set of inputs.

"As a byside question, did you create the Excel data table form a math function?"
-I just created the Excel file by hand.

"In the worst case, you can copy the Excel table in "BLOC" into NotePad and paste
individually each NotePad entry into the Smath image matrix."
-Sorry, I don't know what BLOC is, or what you mean with this. But it seems like this is still help for importing a matrix?

#18 Posted: 4/12/2016 12:28:11 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

"You created the Excel table by hand" => make sure there are no empty cell.
Fill any empty cell with 0 to get square/rectangular all valued array.

"copy in bloc" => select all cells in Excel ... copy, paste in NotePad.

Can't see why Smath does not read my test Excel ?
Transit cell by cell via NotePad is dark age technique.

Cheers [Edmonton], Jean.

#19 Posted: 4/12/2016 12:39:00 PM
Kemili

Kemili

1 likes in 10 posts.

Group: User

There are no empty cells within the range of the stated A3:B11. I hope you don't mean the entire excel sheet?

I'm not really sure why your SMath doesnt read my Excel files either, but I had added a matrix in case import from excel didn't work, because that isn't my focus. Can you not open the excel at all? This is what it looks like.
File not found.File not found.
#20 Posted: 4/12/2016 1:10:57 PM
Ernesto

Ernesto

13 likes in 74 posts.

Group: User


I believe I performed what you intended. Files need to be in the same directory.

Let me know if this is what you needed.


inputs.xlsx (7 KiB) downloaded 47 time(s).
example.sm (16 KiB) downloaded 78 time(s).
  • New Posts New Posts
  • No New Posts No New Posts