store different output in single file for every combination of varible
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Antworten (1)
Padam
am 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--');
0 Kommentare
Siehe auch
Kategorien
Mehr zu Signal Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!