Find percent difference between 2 columns in variable?

10 次查看(过去 30 天)
So I have a variable, x, that has a size of 300x2. It calculates the fraction of an image that is white, and therefore it produces the fraction twice. I'd like to compare the percent difference between the two results for each file in the directory. Would the pDIF function be the best way to do that?
  2 个评论
Image Analyst
Image Analyst 2020-2-19
Never heard of the pDIF function. I presume you have 300 images, so each row of x has the white fraction twice? Where do you want the percent difference? And what is the reference for your percentage? Like for the k'th image is it
percentDifference(k) = results(k) / results(1)
where you compare everything to the first image? Or did you have something else in mind?
Shayma Al Ali
Shayma Al Ali 2020-2-19
So for example, in Image 1, the function produces fractions. So column 1 has the first fraction, and column 2 has the second fraction. I want to know the percent difference between the two fractions for each image, if that makes sense. So each image has a calculated percent difference between its results.

请先登录,再进行评论。

回答(1 个)

Srivardhan Gadila
Srivardhan Gadila 2020-2-24
There is no function pDIF in MATLAB.
The following question might help you: Percentage Difference of Values stored in Two Matrices
In case of calculating percent difference for multiple images/elements, please make use of rdivide, ./

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by