Hi, I need to read trc file. I tried to used to this website https://www.mathworks.com/matlabcentral/fileexchange/48919-readtrc-read-r-s-trc-files-into-a-matlab-cell-array . I don't know actually, how to work with this. I have this function in a file and in the second .m file a wrote just this readtrc('data.trc') (data.trc is my goal file). Can you help me, how to load data? thanks

댓글 수: 5

KSSV
KSSV 2017년 12월 26일
traces = readtrc(filename) ;
And then....if there is no error, your data should be read in the variable traces. What difficulty you have?
Margareta Drozdikova
Margareta Drozdikova 2017년 12월 26일
편집: Margareta Drozdikova 2017년 12월 26일
I have written
traces=readtrc('data.trc')
and I got this
Subscript indices must either be real positive integers or logicals.
Error in readtrc (line 20)
traces{k+1,1}=cell2mat(Columns(TracesIdx(size(TracesIdx))+4:size(Rows{1,1})));
Error in skuska1 (line 1)
traces=readtrc('data.trc')
Jeff Warner
Jeff Warner 2020년 10월 12일
I got the same error.
Array indices must be positive integers or logical values.
Error in readtrc (line 20)
traces{k+1,1}=cell2mat(Columns(TracesIdx(size(TracesIdx))+4:size(Rows{1,1})));
Marco
Marco 2023년 5월 15일
This fix is working for me:
%% Extract Data
if length(TracesIdx) == 1
%% Stores individual traces in a cell
k=1;
traces{k,1}=cell2mat(Columns(TracesIdx(k)+4:end));
else
%% Store multiple traces in a cell-array
for k=1:length(TracesIdx)-1
traces{k,1}=cell2mat(Columns(TracesIdx(k)+4:TracesIdx(k+1)-1));
end
traces{k+1,1}=cell2mat(Columns(TracesIdx(size(TracesIdx))+4:size(Rows{1,1})));
end
% Store the header in the last cell element:
traces{end+1,1}=Rows{1,1}(1:16,1);

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

답변 (0개)

카테고리

태그

질문:

2017년 12월 26일

댓글:

2023년 5월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by