store different output in single file for every combination of varible

2 vues (au cours des 30 derniers jours)
GD
GD le 14 Mai 2025
Réponse apportée : Padam le 14 Mai 2025
I have two variables named parameter_x=[5 5]. output is s11. whenever I change this parameter_x value different s11 is coming. but I want to preserve all s11 value for every combination .how to store in single file.
param_X = [5 5];
runPyCmd = ['ipy64 OPTScript.py ', num2str(param_X)];
[~,msg] = system(runPyCmd);
SData_original = readtable('S11.csv', 'VariableNamingRule', 'preserve')
figure(1)
plot(SData_original{:,1},SData_original{:,2},'r--');
xlabel('Freq (GHz)'); ylabel('S11 (dB)'); grid on; hold on;
  1 commentaire
Matt J
Matt J le 14 Mai 2025
Modifié(e) : Matt J le 14 Mai 2025
There is no parameter_x (though there is param_X) or s11 in the code you've posted. In any case, it sounds like a simple loop will do what you want,

Connectez-vous pour commenter.

Réponses (1)

Padam
Padam le 14 Mai 2025
I'm assuming SData_original returned by the readtable function is a 1-by-2 table and the values in each column of the table is a scalar. If my assumption is correct, this code will address your need:
% This routine will prompt you to input the param_X value repeatedly, one at a time.
% When you have entered all your values, type END to exit the routine and plot the results.
SData = []; % Initialize an array to store all output values
while true
% Prompt to enter param_X or the string 'END'
param_X = input('Enter an array (e.g., [1 2]) or a string (e.g., END): ', 's');
% Check if the user wants to end the loop
if strcmpi(strtrim(param_X), 'END')
break % Exit the loop if 'END' is entered (case-insensitive)
else
runPyCmd = ['ipy64 OPTScript.py ', param_X];
[~,msg] = system(runPyCmd);
SData_original = readtable('S11.csv', 'VariableNamingRule', 'preserve');
% Store the first and second columns of the table in the array
SData(end+1,1) = SData_original{:,1};
SData(end,2) = SData_original{:,2};
end
end
figure(1)
plot(SData(:,1),SData(:,2),'r--');

Catégories

En savoir plus sur Signal Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by