Help with error Invalid argument at position 2. Function requires exactly 1 positional input(s).

I need some help debugging an error I am seeing in my command window when trying to invoke a static method.
This is the code I have began writing to remotely control a visa instrument.
classdef TandE
methods(Static)
function insertionloss(machine, ip, calfile)
switch machine
case 1
vna = visadev('ni', ip);
fopen(vna);
%Setup Calibration / Port Mapping
write(vna, "SYST:PRESET");
write(vna, "MMEM:LOAD:CSAR" + ' ' + calfile);
write(vna, "*WAI");
write(vna, "SENS:SWE:MODE CONT");
fclose(vna);
case 2
otherwise
warning('Unexpected Machine')
end
end
end
end
When I try to call the function I am hit with this error. I am not quite sure what I am doing incorrectly but some help would be appreciated.
>> a = TandE
a =
TandE with no properties.
>> a.insertionloss(1, ip, calfile)
Error using TandE.insertionloss
Invalid argument at position 2. Function requires exactly 1 positional input(s).
>>

 채택된 답변

Tanner Fortier
Tanner Fortier 2022년 12월 27일
이동: Voss 2022년 12월 28일
Issue was fixed, found it it was due to the visadev call and not the function call. Was using visa to call before and did not realize that the newer visadev did not have the same requirements for a call.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Downloads에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2022년 12월 27일

이동:

2022년 12월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by