[SOLVED] save 1d result through MATLAB

Status
Not open for further replies.

yattharth

Junior Member level 1
Joined
Sep 13, 2013
Messages
17
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Activity points
109
hi everyone
can someone give the matlab code to save 1d result>>probe i am doing it this way:


can someone provide suggestions.....
 
Last edited by a moderator:

hi everyone
i just realized that :
Code:
mws.invoke('saveas','path_name','true');
will do the job
however exporting the probe results to matlab still remains a problem.....
can someone provide the command for exporting the E field values into matlab ????

thanks
 
Last edited by a moderator:

Code:
DLL_Path = '..\';
HeaderPath = '.\';
libname = 'CSTResultReader';
if (strcmp(computer, 'PCWIN64')) 
    libname = 'CSTResultReader_AMD64';
    DLL_Path = '..\AMD64\';
end
CSTResultReader = strcat( DLL_Path, libname, '.dll' );
CSTResultReaderH = strcat( HeaderPath, 'CSTResultReaderInterf.h' );
loadlibrary(CSTResultReader,CSTResultReaderH);

% Show a summary of all available functions in the .dll. It also shows what arguments
% a function call needs in matlab.
%libfunctionsview CSTResultReader 

% Project from the current directory
mwsProjName = '.\TEST1.cst';
%mwsProjName = '.\coaxial connector fd-tet 2012.cst';
sTree1DName = '1D Results\Probes\E-Field\E_Probe [1]';

% Initalize the return value
ret = 0;

% Define the CST project handle
sHandle = libstruct('CSTProjHandle');
sHandle.m_pProj = 0;

% Initialize the handle
[ret, mwsProjName, sHandle] =calllib(libname, 'CST_OpenProject', mwsProjName, sHandle);

% Specify the desired result number. In most cases there is only one result.
% (as assumed here)
iResultNumber = 0;

% Size of expected 1D-Data
nSigSize = 0;

% Ask for the size of the expected data vector.
[ret, sHandle, sTree1DName, nSigSize] = calllib(libname, 'CST_Get1DResultSize', sHandle, sTree1DName, iResultNumber, nSigSize);

% Define an array of proper size. 
% Since a two-component result is requested, the previously encountered data size is large enough 
% to cover all those values. However, the abscissa values are of real type (1 component values) 
% and so the storage needs to be only half of that size.
% NOTE: If the array size does not have the proper size, matlab may crash!
xVal=zeros(nSigSize,1);

% Get the frequency values.
[ret, sHandle, sTree1DName, xVal] = ...
calllib(libname, 'CST_Get1DRealDataAbszissa', sHandle, sTree1DName, iResultNumber, xVal);

% Get the complex S11 values.
yVal=zeros(nSigSize*2,1);
[ret, sHandle, sTree1DName, yVal] = ...
calllib(libname, 'CST_Get1D_2Comp_DataOrdinate', sHandle, sTree1DName, iResultNumber, yVal);

% Extract the complex components from the vector.
Sre = yVal(1:2:length(yVal));
Sim = yVal(2:2:length(yVal));
 re=Sre(451,1);
 im=Sim(451,1);

% Create a 1D-Plot of the absolute value of S11 versus frequency.

%plot(xVal,Sre,xVal,Sim);

% Close the CST project handle.
[ret, sHandle] = ...
calllib(libname, 'CST_CloseProject', sHandle);

% Free the library.
unloadlibrary(libname)


just make sure u r in the right directory...
 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…