Azzera filtri
Azzera filtri

How to replace specific areas in matlab figure by zero?

5 visualizzazioni (ultimi 30 giorni)
I have a matlab figure file as shown below. I have extracted this image into a matrix named 'figmat' using the code
openfig('newmeas.fig');
figmat=get(get(gca,'Children'),'CData');
1) How to know which rows and columns in 'figmat' correspond to this bottom yellow line?
2) How to replace the bottom bright yellow line with zero values in 'figmat'?

Risposta accettata

Walter Roberson
Walter Roberson il 6 Mag 2017
You can see that the axes increase in both directions away from the bottom left corner. In MATLAB, that is the case when the axes XDir and YDir properties are both set to 'normal'. When they are both set to normal, then the lower left corner of the display corresponds to CData(1,1,:), and the upper left corner corresponds to CData(end,1,:); the lower right corresponds to CData(1,end,:) . The bright yellow line therefore corresponds to rows near the beginning of the CData.
It is not clear to me that the line corresponds to CData(6,:,:) only; there might be a couple of values in the row before or after that which have the same color.
I would suggest trying
f = openfig('newmeas.fig');
obj = findobj(f, 'hasprop', 'CData');
figmat = get(obj, 'CData');
fm2 = figmat;
fm2(6,:,:) = 0;
set(obj, 'CData', fm2);
  11 Commenti
Sachin Nag
Sachin Nag il 9 Mag 2017
Modificato: Sachin Nag il 9 Mag 2017
@Walter, thanks for the suggestions. I tried with few things and obtained the image as uploaded here where I could get some of the bottom rows to be valued to zero. But now an other question remains for me. The light blue color (cyan) sloped line you see approximately between the values 300 and 400 is a useful signal and the values from 200 and below (with the same color) are noise.
1) How to make only the noise part zero preserving the values of the useful signal?
2) Is there any way to extract portion of images as a matrix or identify in the original matrix which row/column corresponds to which part in the image?
Thanks for any assistance
Walter Roberson
Walter Roberson il 9 Mag 2017
"Is there any way to extract portion of images as a matrix or identify in the original matrix which row/column corresponds to which part in the image?"
With the plotting you have done, the x coordinate is the column number of the data, and the y coordinate is the row number of the data.
"How to make only the noise part zero preserving the values of the useful signal?"
You really need to go back to the original data instead of working with the drawn data.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by