How to remove border from MATLAB figure
I’m trying to compare spectrogram images in a MATLAB image analyzer, but I think the white border is causing them to be overly similar. Because of the number of images I need to process, I’d really like to have it automatically generate and save the image. Here is my current code that I’m using to make and save the spectrogram.
base=filename %The code saves multiple images with the label being the filename and a specific addition to each image
figure(1003)
spectrogram(Xacc,windowx,noverlap,nfft,fs,’yaxis’)
ylim([0 5])
colormap(gray(256));
caxis([-160 40])
% title(‘Spectrogram of X’)
s1=base + "SPEC_Acc_X GS";
saveas(gcf,s1,’jpg’)
When I run it I get an image like this.
What I want is an image like this, but in order to get it I had to adjust every setting manually in the image editor. Alternately, is there a way to automatically crop saved images? That could also be a solution.
Thanks so much for the help!I’m trying to compare spectrogram images in a MATLAB image analyzer, but I think the white border is causing them to be overly similar. Because of the number of images I need to process, I’d really like to have it automatically generate and save the image. Here is my current code that I’m using to make and save the spectrogram.
base=filename %The code saves multiple images with the label being the filename and a specific addition to each image
figure(1003)
spectrogram(Xacc,windowx,noverlap,nfft,fs,’yaxis’)
ylim([0 5])
colormap(gray(256));
caxis([-160 40])
% title(‘Spectrogram of X’)
s1=base + "SPEC_Acc_X GS";
saveas(gcf,s1,’jpg’)
When I run it I get an image like this.
What I want is an image like this, but in order to get it I had to adjust every setting manually in the image editor. Alternately, is there a way to automatically crop saved images? That could also be a solution.
Thanks so much for the help! I’m trying to compare spectrogram images in a MATLAB image analyzer, but I think the white border is causing them to be overly similar. Because of the number of images I need to process, I’d really like to have it automatically generate and save the image. Here is my current code that I’m using to make and save the spectrogram.
base=filename %The code saves multiple images with the label being the filename and a specific addition to each image
figure(1003)
spectrogram(Xacc,windowx,noverlap,nfft,fs,’yaxis’)
ylim([0 5])
colormap(gray(256));
caxis([-160 40])
% title(‘Spectrogram of X’)
s1=base + "SPEC_Acc_X GS";
saveas(gcf,s1,’jpg’)
When I run it I get an image like this.
What I want is an image like this, but in order to get it I had to adjust every setting manually in the image editor. Alternately, is there a way to automatically crop saved images? That could also be a solution.
Thanks so much for the help! image editing, border removal MATLAB Answers — New Questions