i am trying to fetch integer value stored in result_cluster.txt and trying to store into an array
aiclu(i,1)=a;
but I'm not getting the desired result. Instead a value of 0 is stored in the array. Here's my code:
fid20=fopen('result_cluster.txt','r');
i=1;
k=1;
aclu_end=zeros(11,1);
aiclu=zeros(962,1);
while(~feof(fid20))
a=fscanf(fid20,'%d',1);
disp(a);
disp(i);
aiclu(i,1)=a;
i=i+1;
disp(aiclu(i,1));
if a==32
aclu_end(k,1)=i;
disp('hello');
disp(aclu_end(k,1));
k=k+1;
end
end
fclose(fid20);
result_cluster.txt
2
3
4
34
56
81
85
89
102
109
110
...
I get this output:
disp(a) = 2
disp(i) = 1
For aiclu(i,1)=a; I get this error: "??? Subscripted assignment dimension mismatch."
ais a single value and not a vector?abeing a vector would cause that error.