DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Macro for loading multiple data files

 
Post new topic   Reply to topic    DPlot Forum Index -> General discussion
View previous topic :: View next topic  
Author Message
azeigle



Joined: 09 Oct 2020
Posts: 5

PostPosted: Fri Oct 09, 2020 1:02 pm    Post subject: Macro for loading multiple data files Reply with quote

I'm new to DPlot and want to write a macro which loads multiple csv files into a new plot. I have something kind of working, but would like to expand it's capabilities. Below is what I have written so far.

Code:
FileNew()
FileType(4)
ForFilesIn("D:\macro_test\*.csv",A)
VAR_C=Request("fname")
Legend(1,"VAR_C")
NextFile


Improvements I would like to make:
1. Set each curve name to the file name. Right now it sets the name of the current file to curve 1. I can't find any documentation on numeric variables and how I can use them to update the curve number each time through the loop.

2. Is it possible to do any kind of string manipulation on string variables (such as VAR_C) so I can strip off the file extension, or use only part of the file name, etc?

3. When it opens a file, it asks me to specify which columns to plot. I want to set it to alternating x,y columns, and choose all the columns. Can this be automated so I don't have to set these options and click OK for each file?

And one unrelated question. Is it possible to specify a default font type for the macro editor? I prefer monospace fonts for scripting. But right now I have to set the font type every time I open the editor.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Sat Oct 10, 2020 7:10 am    Post subject: Reply with quote

1. Unfortunately "Use as Legend" only works when you open multiple files OR when you're appending to an existing graph (where there is already a "Curve 1").
2. Sorry, no. And this will not likely happen with macros.
3. ColumnsAre(0) will get rid of that dialog box and use all columns.

If the macro editor is closed normally (i.e. not a crash) then the font should be preserved - it is for me when I tried just now.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
azeigle



Joined: 09 Oct 2020
Posts: 5

PostPosted: Mon Oct 12, 2020 6:52 pm    Post subject: Reply with quote

Thanks for the quick response! The font I choose is now coming up as the default. I'm not sure what I was doing wrong before.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> General discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group