Matlab crashes/closes unexpectedly while saving the matrix
4 次查看(过去 30 天)
显示 更早的评论
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.
- 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.
- 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 ??
8 个评论
Jan
2021-6-3
"I am intend to find the symmtery in the image" - prefer to ask a new question for a new problem.
The answer will be: There is no symmetry in this image.
采纳的回答
Star Strider
2021-6-3
‘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.
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')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641335/image.png)
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!
.
7 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!