check the empty cell of a table.

11 views (last 30 days)
muharrem akcadg
muharrem akcadg on 6 Aug 2018
Edited: Adam Danz on 7 Aug 2018
Hi guys, I am trying to read table from txt file and split it to two parts. So, I am reading as myTable.Column(X:Y). Y depends on the total lines of the txt file. But I cannot check the empty cell on it for stopping the loop and I got error 'index exceeds array bounds' I tried isempty() but it didn't work can you help ? stim_duration=2;
array4A_1=[];
write2 = fopen('PARTA.txt','wt');
while (t_count<line/(stim_duration*128*2))
part=1*foo;
temp=128*sec_2;
while(part<temp)
ss_A=ss_A+ sum(table.FIRST(part+1));%%%burayı bir eksilt
B4A_1=[array4A_1 ;table.FIRST(part+1)];
fprintf(write2,'%s\n',table.FIRST(part+1));
array4A_1=B4A_1;
part=part+1;
end
foo=128*2*sec_3; %%
sec_3=sec_3+stim_duration;
sec_2=sec_2+(stim_duration*2);
t_count=t_count+1;
end
save('1_COL_A','B4A_1');
AR=std(B4A_1);
disp('1.COLUMN A PART DEVIATION:');
disp(AR);
mean_A4_1=ss_A/(128*stim_duration*t_count);
write = fopen('PARTB.txt','wt');
%%1. COLUMN PART B
array4B_1=[];
et=0;
while(et<13)
partb=1*q*128;
temp2=128*u*2;
while(partb<temp2)
ss_B=ss_B+ sum(table.FIRST(partb+1));
B4B_1=[array4B_1 ;table.FIRST(partb+1)];
fprintf(write,'%s\n',table.FIRST(partb+1));
array4B_1=B4B_1;
partb=partb+1;
end
q=q+4;
u=u+stim_duration;
et=et+1;
end
save('1_COL_B','B4B_1');
AR2=std(B4B_1);
disp('1.COLUMN B PART DEVIATION:');
disp(AR2);
disp('MEANB');
mean_B4_1=ss_B/(128*stim_duration*et);
disp(mean_B4_1);
i split the parts as every 128*2 times.
  1 Comment
Adam Danz
Adam Danz on 7 Aug 2018
Edited: Adam Danz on 7 Aug 2018
Rather than reverse-engineering your code, could you make it easier for us to know which loop is causing you the problem? I counted 4 while loops.
Also, to increase readability (and the probability of someone helping), you could format your code better. In the matlab editor, highlight all of your code, then press ctrl+i. This will properly indent your code.

Sign in to comment.

Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!