# Why am I getting the error "Array indices must be positive integers or logical values."?

1 view (last 30 days)
Deepu S S on 23 Nov 2021
Answered: Image Analyst on 23 Nov 2021
function [Fluindex ] = find_Findex(Signal,timeframe,SampRate,slide )
%FIND_Kurtosis Summary of this function goes here
% Detailed explanation goes here
channels=size(Signal,2);
nFrames=size(Signal,1)/(timeframe*SampRate);
Fluindex=[];
if slide <=0
partition=1;
else
partition=slide/timeframe;
end
for f = 1:partition:nFrames
start_ind =((f-1)*timeframe*SampRate)+1;
end_ind = f*timeframe*SampRate;
Fluind_frame=[];
for i= 1:channels
Findex = zeros(2,3,4);
size(Findex)
Fluind_frame = zeros(3,4,5,6);
size( Fluind_frame)
Fluind_frame(:,i)= Findex (Signal(start_ind:end_ind,i));
end
Fluindex=cat(1,Fluindex,Fluind_frame);
end
end
when i run above code its show error like this.
Error using find_Findex
Array indices must be positive integers or logical values.
"why its showing like this??"
##### 2 CommentsShowHide 1 older comment
Deepu S S on 23 Nov 2021
@KSSV please check the attached file

Image Analyst on 23 Nov 2021
It's a FAQ, probably the #1 most FAQed FAQ.
Here is a thorough discussion of how that error occurs:
{"ft_lang_label":"__label__en","ft_lang_prob":0.6150038,"math_prob":0.9204964,"size":1371,"snap":"2023-14-2023-23","text_gpt3_token_len":377,"char_repetition_ratio":0.11338698,"word_repetition_ratio":0.05586592,"special_character_ratio":0.25091174,"punctuation_ratio":0.16602316,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9885155,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-04-02T02:36:57Z\",\"WARC-Record-ID\":\"<urn:uuid:444ea87a-39c4-4fe1-bf11-3bb03776b76e>\",\"Content-Length\":\"137536\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:5278270b-edd3-463a-9e55-1044aad22e24>\",\"WARC-Concurrent-To\":\"<urn:uuid:bc21e83d-7071-4d89-875d-bb1874343804>\",\"WARC-IP-Address\":\"104.68.243.15\",\"WARC-Target-URI\":\"https://it.mathworks.com/matlabcentral/answers/1593409-why-am-i-getting-the-error-array-indices-must-be-positive-integers-or-logical-values\",\"WARC-Payload-Digest\":\"sha1:Z6CDP6MHZG66SVWAV3DDSOBQUOYPTNY4\",\"WARC-Block-Digest\":\"sha1:S5URDWLWTDUOZNO3ZJIIUU2ERQMDF7O6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296950373.88_warc_CC-MAIN-20230402012805-20230402042805-00454.warc.gz\"}"}