Message Boards Message Boards

0
|
3815 Views
|
5 Replies
|
4 Total Likes
View groups...
Share
Share this post:

[Solved] Loop a fourier calculation and export to csv-file

Posted 3 years ago
Attachments:
POSTED BY: alltimetrader
5 Replies

Hi Mike, My approach: prior to the calculations, create a two dimensional empty table:

results = Table[Table[{}, columns], rows];

then after filling it with data, export it to a file name ending in .csv

Export[somePath <> "myresults.csv", results];

If you want a header row in your file:

resultsHeader = {col1label, ... };
Export[somePath <> "myresults.csv", Join[{resultsHeader}, results]];
POSTED BY: Richard Frost
Posted 3 years ago

Much appreciated! Perhaps your idea could be combined with the "Do" command to get the loop sorted but still seems uncertain to me how I implement that each s gets its own column until all calcs are done.

POSTED BY: alltimetrader

Or ... you could do the columns one at at time, knowing which column the current s belongs to.

POSTED BY: Richard Frost
Posted 3 years ago

Hi alltimetrader

There is no need to create an empty Table and fill it using Do or some other looping construct. One way to deal with your problem is to encapsulate the generation of sums for a specific value of s and steps in a function. Then call the function in a Table to generate the desired output.

I modified your notebook and added the proposed solution in the attached "test loop atco v2.nb". The changes are at the end. No existing code was modified.

Attachments:
POSTED BY: Rohit Namjoshi
Posted 3 years ago

Wow Rohit. You made my day. Much obliged. Much to be learned..

Thanks!

//Mike

POSTED BY: alltimetrader
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract