Use y./(3*x)
to do element-wise division.
Note the operator: ./
Question
I need to load two data files each of which have 6 columns and I want to plot the ratio of a column from first data file and another column from the second data file. But I keep getting a memory error. None of the numbers are zeros. I plotted the same in Excel. Worked ok. But I need it in Matlab, What do I do?
My current code is something like this:
load file1.dat;
y=file1(:,2);
time=file1(:,1);
hold on;
load file2.dat;
x=file2(:,5);
figure;
plot (t,y/(3*x),'LineWidth',1);
xlabel('Time (s)');
ylabel('Mitochondrial Calcium (um)');
This is the error I get:
Error using \
Out of memory. Type HELP MEMORY for your options.Error in plotCmyo (line 9) --> File name, line 9 is the one with the plot command
plot(t,y/x, 'LineWidth',1);
La solution
Use y./(3*x)
to do element-wise division.
Note the operator: ./