MATLAB: Does the Macbook Pro, OS 10.8.5, run Matlab R2012b so slowly

macbook proos 10.8.5 running matlab r2012b slowly

Dear,
I made a simple iteration code in Matlab 2012b and plot a diagram for it, my code is below. I did it by my Mac pro, Os 10.8.5 but it took a lot of time to process it. Even it made my MAC hang up.
my code is below:
delta_t = 0.01;
for i = 1 : 30000
t(i) = delta_t*i;
end
load data.mat;
y = zeros(30000);
for col = 1 : 8
for row = 1 : 3750
y(3750*(col-1)+row) = data(row,col);
end
end
figure(1);
hold on;
grid on;
plot(t,y,'r-o');
legend('xxx');
xlabel('time');
ylabel('data');
%axis([0 30 10^(-2) 1]);
Thanks.

Best Answer

I guess, that this is a typo:
y = zeros(30000)
This reserves 30'000 * 30'000 elements, which require 7.2 GB of free contiguous RAM. If this exhausts the memory, the much slower disk swapping might take the time. Perhaps you mean:
y = zeros(1, 30000)
Unfortunately exhausted memory let Matlab and other applications crash frequently, although it is possible in theory to display a helpful error message. But in practice the creation of a message in a dialog requires memory...
By the way, your program looks strange. What about:
t = 0.01 * (1:30000);
y = data(:);