How to make indices integers/logicals while filling 3D matrix with data?
이전 댓글 표시
Hello,
I got error: 'Subscript indices must either be real positive integers or logicals.'
While filling 3D matrix using triple loop:
function [m3d] = matrixfill(ROIs, dm)
%Filling 3D matrix with phase difference values for ROIs pairs and saving
%to .mat file.
ROIs_length = length(ROIs);
time_length=size(dm,1); %to define time we need to know length of time series
times=0:1.83:((time_length-1)*1.83); %time defined
for d=1:ROIs_length
x=[times; dm(:,ROIs(d))'];
for e=1:ROIs_length
y=[times; dm(:,ROIs(e))'];
[Rsq,period,scale,coi,sig95,X,Y,Wxy,sWxy,ejpdXY]=wtc_AA(x,y,'MonteCarloCount',1);
period_length=length(period);
for f = 1:period_length
freq=period(f);
m3d = zeros(period_length,ROIs_length,time_length); %3D matrix filled with zeros
m3d(d,x,f) = mean(angle(Wxy(freq,:)));
%error: Subscript indices must either be real positive integers or logicals.
%filling matrix with means of phase difference
end
end
filename=sprintf('for_ROI%d.mat',d);
save(filename);
end
end
How to fix it?
Thanks in advance.
Kasia
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!