trying to select multiple files to use in multiple s-parameter plots. I can see the file name when I manually use file1{1,2} but sparameters doesn't like it.

1 view (last 30 days)
DefPath = 'C:\tmp\new anenna stuff\*.s4p'
[FileName, PathName] = uigetfile(DefPath,'MultiSelect','on')
file1 = [PathName,FileName]
Error using rf.internal.netparams.AllParameters
Undefined function 'sparameters' for input arguments of type 'cell'.
Error in rf.internal.netparams.ScatteringParameters
Error in sparameters (line 80)
obj = obj@rf.internal.netparams.ScatteringParameters(varargin{:});
Error in Plot_SParameter_s4p_File (line 8)

Answers (1)

Walter Roberson
Walter Roberson on 6 Oct 2022
DefPath = 'C:\tmp\new anenna stuff\*.s4p';
[FileNames, PathName] = uigetfile(DefPath,'MultiSelect','on');
if isnumeric(FileNames); return; end %user cancel
%if user selected exactly one file you got a character vector,
%otherwise a cell of character vectors. We want consistency
FileNames = cellstr(FileNames);
full_filenames = fullfile(PathName, FileNames);
objs = cellfun(@sparameters, full_filenames, 'uniform', 0);
hold on
h = cellfun(@(OBJ) rfplot(OBJ, 1, 2), objs, 'uniform', 0);
hold off
xlim auto; ylim auto
[~, basenames, ~] = fileparts(full_filenames);
legend(h, basenames);


Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by