# Matlab crashes/closes unexpectedly while saving the matrix

13 views (last 30 days)
Turbulence Analysis on 3 Jun 2021
Edited: Jan on 5 Jun 2021
Hi,
I am running my codes in the Matlab that installed in the server. My code deals with processing 5000 files in a for loop, at the end I suppose to save one big matrix.
I have observed crash /unexpected close of matlab duirng follwing instants.
1. Everything was normal till last iteration of for loop i.e. 5000, it closes amid saving my big matrix. Actually, the size of the matrix is 500 mb, previuoly I was succesful in saving matrix of ~10 gb with the same code.
2. Sometimes I am succesful in saving the matrix, however, matlab closes while I am trying to read the saved matrix..
Could someone advice me in this ??
Turbulence Analysis on 3 Jun 2021
Thanks, Jan for the suggestion..
Yes, I have made the seperate post

Star Strider on 3 Jun 2021
BTW, I am intend to find the symmtery in the image, for e.g. finding symtericity about y axis in the case of attached figure, Have you dealth anything similar to this ??
I have not. However it doesn’t appear to me to be symmetrical. One option may be to use the centroid function (introduceed in R2017b) to get the (x,y) coordinates. You can then use the ‘x’ value to calculate the symmetry. I am not certain how best to define ‘symmetry’ or test for it.
On an interweb search, I was only able to find one File Exchange contribution that might be useful: Novel Method for Determining Symmetry of Skin Lesions using the Jaccard Index, so it woould likely be worthwhile to search the File Eschange to see if there are others that could apply to what you want to do.
Taking a stab at this just for fun, using the ‘x{1}’ and ‘y{1}’ results from my previous Answer
ps1 = polyshape(x{1},y{1}); % Create Polyshape Object
[xc,yc] = centroid(ps1) % Centroid
flipcurv = x{1}<=xc; % Logical Indices To Left Of Centriod ‘x’ Value
xfc = xc - x{1}(flipcurv); % Flipped ‘x’-Coordinates
yfc = y{1}(flipcurv); % Corresponding ‘y’-Coordiantes
xrc = x{1}(~flipcurv)-xc; % Right-Hand-Side Of Contour ‘x’-Coordinates (Not Flipped)
yrc = y{1}(~flipcurv); % Right-Hand-Side Of Contour ‘y’-Coordinates (Not Flipped)
ang1 = atan2(yfc-yc,xfc); % Angles
r1 = hypot(yfc-yc, xfc); % Radii
[Uar1,ar1ix] = unique([ang1(:),r1(:)], 'rows'); % Unique [Angles Radii]
afi = linspace(min(Uar1(:,1)), max(Uar1(:,1)), 1000); % Interpolation Vector
rfi = interp1(Uar1(:,1), Uar1(:,2), afi); % Interpolated Value
ang2 = atan2(yrc-yc,xrc); % Angles
r2 = hypot(yrc-yc, xrc); % Radii
[Uar2,ar2ix] = unique([ang2(:),r2(:)], 'rows'); % Unique [Angles Radii]
ari = linspace(min(Uar2(:,1)), max(Uar2(:,1)), 1000); % Interpolation Vector
rri = interp1(Uar2(:,1), Uar2(:,2), ari); % Interpolated Value
[r,p] = corrcoef(rfi(:),rri(:)); % Correlation (One Of Many Possible Measures Of Similarity)
[xfi,yfi] = pol2cart(afi,rfi); % Convert Back To Cartesian
[xri,yri] = pol2cart(ari,rri); % Convert Back To Cartesian
figure
plot(xfc, yfc)
hold on
plot(xrc, yrc)
hold off
grid
axis('equal')
figure
plot(xfi,yfi)
hold on
plot(xri,yri)
hold off
grid
axis('equal')
title('Interpolated & Re-Plotted Overlapped Curves')
legend('Flipped Left-Half', 'Original Right-Half', 'Location','best')
This code produces equal-length vectors (plotted) that can now be compared with each other in any number of ways. I defer to you to explore those options!
.
Turbulence Analysis on 4 Jun 2021
I have just posted new thread on seeking solutions into the inetnsity correction in the images..
Please do have a look.. Sorry for too many questions..