The Siemens Community Catalyst program was co-created with our community to acknowledge technology leaders who consistently contribute to the Siemens Community. Nominations are accepted on a rolling basis.
Hi, I need to write/generate a .txt file from compose. Can someone help? Thanks in advance.
Hi Saransakthi,
write a .txt file from Compose is as simple as this:
clc,clear,close all fid = fopen('newtxtfile.txt','w'); fwrite(fid,'this is a .txt file'); fclose(fid);
What do you have to write?
Cheers,
L
You may also print your variables on the text file that you just created and opened:
fprintf(fidout, 'Example of mixing text and variables: %.3f %.2f %8d\n', variable1, variable2, variable3);
Where variable1 will be written with 3 decimal digits, variable2 with 2 decimal digits and variable3 as an integer. The command \n will break the line after you write all content.
And you don't need to worry if your newtxtfile.txt is already in your folder... Once you create it again with Compose, it will overwrite the previous file, so you should not expect any kind of error saying that the file already exists.
Regards,
Roberta
Thanks for your help. I needed to create a table with frequency and amplitude as inputs
Saransakthi,
Using the syntax I mentioned, you may put your frequency variable in variable1 and your amplitude in variable2, adjusting the decimal precision as you wish.
After printing everything in your file using fprintf, it's a good practice to close your files (using fclose function in thi case)
Thanks,
Also, I have plotted an FFT graph in compose. Is there a way to isolate the maximum amplitude and its corresponding frequency from the graph?
Hello Saransakthi,
are you looking for something similar to this?
Lorenzo
Unable to find an attachment - read this blog
Thanks for your help. Your code works for me.
Cheers.
Join us for a community conversation on accelerating power electronics design, where you'll learn how to leverage the fast simulation capabilities of Simcenter PSIM alongside the powerful design exploration and optimization features of Simcenter HEEDS. In this webinar, we’ll show how engineers can move beyond manual…
Join us for a community conversation on Pulse Width Modulation (PWM), a fundamental technique in electric motor control, and explore how different PWM strategies can yield significantly different results. This webinar provides a comparative analysis of various PWM methods and their effects on motor efficiency, torque…
Join us for a community conversation to discover the Advanced Iterative Solver(AIS) in Simcenter Feko and its application to electrically large and computationally demanding electromagnetic models. The session will provide a general overview of how iterative solution methods can help improve efficiency of large scale…