I am trying to cascade a number of S Parameter objects together. This number is user defineable. I am using the RF Toolbox command "sparameters" to read an .s2p file. The program asks for the number of files that the user wishs to input, then asks for their file names, and stores all the S Parameter objects in the same matrix "SPara".
The program then plots the individual file response. Followed by cascading the two S Parameter objects through the "cascadesparams" command, then plotting the cascaded response. I am able to cascade the files when only processing 2 files because I simply reference the two objects in the SPara matrix with in the "cascadesparams" command. However, the size of the SPara matrix is dependent on the number of files the user wishes to input. How do cascade based on the number of files the user inputs? The end result I would like to make a fuction that I can call any time. Here is my code:
%function S = importSpara()
n = input('Input number of files to be imported & cascaded:\n');
for x = 1:n
SPara(1,x) = sparameters(input('Input file name:\n'));
for i = 1:n
SParaCasc = cascadesparams(SPara(1,1), SPara(1,2));