Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

i have a problem in my code. I get data continous from an instrument. But at times i get a error message stated . what are the ways to overcome this error. I thought of TRY and Catch. Is it possible???

조회 수: 1 (최근 30일)
Index exceeds matrix dimensions.
Error in Battery_check_new (line 107) I_eLOAD(i,:) = str2double(Data_eLOAD_Stringsplit(3));
my code is i AM OPENING THE OBJECT AND GIVING THE SET POINT; THEN IT ENTERS THE LOOP while(exit) i=i+1; tic try fprintf(eLOAD_instr, 'curr %2f',Setpoint); % Setpoint to eLOAD pause(0.1);
%%Get Data from ELR9000
% Setpoint, Current, Voltage, Power
Data_eLOAD_string = query(eLOAD_instr, 'curr?; measure:current?; measure:voltage?; measure:power?');
display('1');
catch
Display('2')
end
% Write Data_string in vector of type struct
%Data_eLOAD_string_vec{i} = Data_eLOAD_string;
Data_eLOAD_Stringsplit = strsplit(Data_eLOAD_string, {' ', ';'});
I_set(i,:) = str2double(Data_eLOAD_Stringsplit(1));
I_eLOAD(i,:) = str2double(Data_eLOAD_Stringsplit(3));
U_eLOAD(i,:) = str2double(Data_eLOAD_Stringsplit(5));
P_eLOAD(i,:) = str2double(Data_eLOAD_Stringsplit(7));
toc
end
How to use Try and catch command to overcome the error??? or any other possibility is there??

답변 (0개)

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by