Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FeatureRequest]: Function to save array to a file. #951

Open
owendare opened this issue Jan 25, 2024 · 1 comment
Open

[FeatureRequest]: Function to save array to a file. #951

owendare opened this issue Jan 25, 2024 · 1 comment
Assignees
Labels
enhancement Additional functionality, performance or other feature request
Milestone

Comments

@owendare
Copy link

Is your feature request related to a problem? Please describe.

it would be good if you could write an array to file in a format that was compatible with fileread()
At present to achieve this requires something like the macro below because if you use echo >"0:/sys/myArray.csv" {var.myArray} , the created file include the curly brackets which cause fileread{} to choke.

var myString = ""
while iterations < #var.myArray
    set var.myString = var.myString ^ """" ^ var.myArray[iterations] ^ """" ^ ","
echo >"0:/macros/conditional_g_code_macros/myArray.csv" var.myString
var readBackArray = fileread("0:/macros/conditional_g_code_macros/myArray.csv",0,{#var.myArray},',')
echo var.readBackArray
echo var.readBackArray[0] ^ " : " ^ var.readBackArray[#var.readBackArray-1]```



### Describe the solution you propose.

Apparent choices are..
1.  Modify echo> command to strip curly brackets from arrays before saving to file.
2.  Create dedicated function to save arrays to file.
Option 1 would seem more logical.


### Describe alternatives you've considered

Perhaps fileread() can strip the curly brackets if present?
This would save having a new function to write the array to file.


### Provide any additional context or information.

Ex. Photos, mockups, etc.
@owendare owendare added the enhancement Additional functionality, performance or other feature request label Jan 25, 2024
@T3P3 T3P3 added this to the After 3.6 milestone Feb 7, 2024
@T3P3
Copy link
Contributor

T3P3 commented Feb 7, 2024

Reasonably low priority as there is a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additional functionality, performance or other feature request
Projects
None yet
Development

No branches or pull requests

3 participants