store different output in single file for every combination of varible

조회 수: 2 (최근 30일)
GD
GD 2025년 5월 14일
답변: Padam 2025년 5월 14일
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
Matt J
Matt J 2025년 5월 14일
편집: Matt J 2025년 5월 14일
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,

댓글을 달려면 로그인하십시오.

답변 (1개)

Padam
Padam 2025년 5월 14일
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--');

카테고리

Help CenterFile Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by