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 how High-Performance Computing (HPC) and Simcenter PSIM work together to meet the increasing demands of modern power electronics simulation. During this one-hour technical session, you'll discover how leveraging HPC can speed up simulations, improve scalability, and empower engineers…
Join us for a community conversation on accelerating your motor simulation workflow with Simcenter Simlab. In this beginner-friendly session, we'll introduce the platform's automated model-building capabilities and show how easy it is to set up your first electric motor analysis. You'll see the basic steps of geometry…
Join us for a Community Conversation where we'll discuss practical approaches to analyzing complex electromagnetic models using hybrid solver techniques. This session will provide a general overview of how different computational methods can be combined within a single simulation to address models containing varied…