Matlab Busy since four hours
Show older comments
Here is my code which when run makes the matlab show busy since hours. What can be wrong? My data is big though!
Y = importdata('Dr_Kucukvar_data.xlsx');
linverse = importdata('L_inverse.txt');
X= Y.data.Diagonal;
mlinverse_1 = X(:,1);
mlinverse_1 = diag(mlinverse_1);
mlinverse_2 = X(:,2);
mlinverse_2 = diag(mlinverse_2);
mlinverse_3 = X(:,3);
mlinverse_3 = diag(mlinverse_3);
mlinverse_4 = X(:,4);
mlinverse_4 = diag(mlinverse_4);
mlinverse = [mlinverse_1 mlinverse_2 mlinverse_3 mlinverse_4];
Result_matrix = zeros(7824,1);
for i= 1:4
u= 7824*(i-1)+1;
g= u +7823;
for j= 0:26
for k= 96:107
h= 163*j + k;
z= zeros(7824,1);
z(h)= 1;
S = mlinverse(:,u:g) * linverse * z;
Result_matrix = [Result_matrix S];
end
end
end
3 Comments
John D'Errico
on 1 Apr 2016
What can be wrong? Big problems take big time. Whether your code actually does what you think it does, that is another question, since we cannot know what it is you really want to do.
Geoff Hayes
on 1 Apr 2016
Muhammad - look at the innermost loop iterating over k
h= 163*j + k;
z= zeros(7824,1);
z(h)= 1;
So on every iteration, you are re-creating z to be a 7824x1 array just to set one element, z(h), to one. Why? Is this intended?
Muhammad Ali Haider
on 1 Apr 2016
Accepted Answer
More Answers (0)
Categories
Find more on Programming 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!