Bayu A Posted October 7, 2022 Share Posted October 7, 2022 Dear All, How to make convert array multidimensional to csv using script in waveform? I will make csv file include 2 column, first column is impedance magnitude value and second column is phase value. Thank Link to comment Share on other sites More sharing options...
0 attila Posted October 7, 2022 Share Posted October 7, 2022 Hi @Bayu A Create a loop and use FileAppendLine, or File.appendLine... or build the string in JS and use FileWrite... Link to comment Share on other sites More sharing options...
0 Bayu A Posted October 8, 2022 Author Share Posted October 8, 2022 Hi, @attila, thans for your response. I have any script like that. var dataImp=[],dataPhase=[]; for(var i = 0; i<3; i++){ conMux(i); wait(0.1); Impedance1.single(); if(!Impedance1.wait()) break; // wait for or exit on stop var phase= Impedance1.Traces.Trace.getData("Phase"); var imp= Impedance1.Traces.Trace.getData("Impedance"); dataImp.push(imp); dataPhase.push(phase); print(i+1);} Supplies.MasterEnable.checked= 0; StaticIO.stop(); FileWrite("~/Desktop/ia/impIM_"+freq+".csv",dataImp); I will create CSV file. First colomn is impedance value and second colomn is phase value. Link to comment Share on other sites More sharing options...
0 Bayu A Posted October 8, 2022 Author Share Posted October 8, 2022 Hi @attila Thank you for your answer. I try it and I finish about that. I try script like that. File("~/Desktop/ia/data_"+freq+".csv").writeLine(dataImp); File("~/Desktop/ia/data_"+freq+".csv").appendLine(dataPhase); but I have any problems. How to transpose row to colomn in array? Link to comment Share on other sites More sharing options...
0 attila Posted October 10, 2022 Share Posted October 10, 2022 Hi @Bayu A Like this: FileWrite("~/Desktop/ia/impIM_"+freq+".csv", ""); // clear file for(var i = 0; i < dataImp.length; i++) FileAppendLine("~/Desktop/ia/impIM_"+freq+".csv", [dataImp[i], dataPhase[i]]); Link to comment Share on other sites More sharing options...
Question
Bayu A
Dear All,
How to make convert array multidimensional to csv using script in waveform? I will make csv file include 2 column, first column is impedance magnitude value and second column is phase value. Thank
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now