Hello everyone, is there a kind soul who could explain to me how I can retrieve the 3D field of an antenna array to use it in my MATLAB calculations? For instance, I want to apply this formula:

 Réponse acceptée

William Rose
William Rose le 1 Jan 2024
Modifié(e) : William Rose le 2 Jan 2024

0 votes

[edit: Fix spelling errors. Add readmatrix() to my answer. Add discussion of some pros and cons of different data-import functions.]
It seems to me that you may have two different questions. If I misunderstand, please explain.
Question 1. How do I get 3D data from the CST suite into Matlab?
CST has an option to export data in text format, also known as ASCII format. Use that option to create a .txt file. Then use the Matlab interactive import data tool, or use readtable(), or use readmatrix(), or strip off the header info in the .txt file, then use load() to import the data. See the help for import data tool, readtable, readmatrix, and load for details. readtable() creates a table, and if you are new to matlab, you may find it slightly more complicated to work with a table. An advantage of readtable(), compared ot load(), is that readtable() brings the column header information into the Matlab environment. load() is simple to use. readtable() can read data from different types of text files and .xls and .xlsx files. readtable() can skip a certain number of header lines. readtable() can read a specific rectangular cell range, if the input file is a .xls or .xlsx.
Question 2. Once I have imported the 3D data, how do I do numerical integration?
That depends quite a lot on the data format and the problem, so I suggest you post a data file, and specify variables and limits of integration, etc., in order to get useful assistance.
Good luck!

6 commentaires

Hello William Rose, thank you for your very relevant insights. I am more focused on Question 2. Indeed, I have a 20x20 element 2D antenna array in MATLAB, and I have also simulated a 20x20 element array in CST. In MATLAB, I approximated the radiation pattern of my excitation source (horn) and that of a single array cell using classical mathematical formulas for reflectarrays or transmitarrays. In a complete simulation, CST provided me with a radiation pattern of the entire array. I want to extract this pattern and use it in my MATLAB code to perform calculations (i.e., use the CST radiation pattern in my 2D MATLAB calculations).
Nikolaos
Nikolaos le 22 Déc 2025
Hello I am trying to create a script in matlab that completely automates the prosses of creation a cst simulation and running it and I am trying to export the results with ASCIIExport function and it can't connect to the cst properly so the command doesn't run
vba_content = sprintf([ ...
'Sub Main\n', ...
' SelectTreeItem "%s"\n', ...
' With ASCIIExport\n', ...
' .Reset\n', ...
' .FileName "%s"\n', ...
' .Mode "FixedWidth"\n', ...
' .StepX 0.1\n', ...
' .StepY 0.1\n', ...
' .UseSubvolume True\n', ...
' .SetSubvolume -1.5, 1.5, -1.5, 1.5, 15, 15\n', ...
' .Execute\n', ...
' End With\n', ...
'End Sub'], ...
tree_path, outfile);
mws.invoke('RunMacro', mcr_file);
That is my code. Can anyone help me ??
William Rose
William Rose le 22 Déc 2025
The matlab code you shared creates a string constant named vba_constant, which has 13 lines (12 newline characters). Then the code calls function mws.invoke() which is part of CST Microwave Studio. I don;t have CST Microwave Studio so I cannot explain why mws.invoke() does not producing the desired results. Your code doesn't use vba_constant. Did you mean to pass vba_constant to mws.invoke()?
I recommend you join the online discussion group for CST Microwave Studios, and post your question there.
Nikolaos
Nikolaos le 23 Déc 2025
Yeah you are right I didnt put the hole code here I am creating a file with the name mcr_file.mcr and I am passing that to the invoke function. But it gives me errors.I was thinking If you know any other way to pass the vba to cst to extract the results from the simulation.
William Rose
William Rose le 24 Déc 2025
@Nikolaos, I do not have CST Microwave Studio, so I cannot assit you.
Nikolaos
Nikolaos le 24 Déc 2025
Don't worry I found the answer. I had to create a file in the C\program files\CST folder so that CST could see it
thanks though

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by