How to work rdivide function
Show older comments
Hi Everone,
I have a question in relation to the rdivide function.
I tried to use the rdivide function with two arrays but the program only provided a resultant array without any vauable result, not even zeros!!
Please refer to the following what expression I used initially and after to circumvent the shortage of computation one by one of array elements:
R = rdivide(abs(i_min_1(1,1)),i_max_1(1,1));
It only worked by simple but very struggle way, piece by piece as it goes:
r_1=abs(i_min_1(1,1))/i_max_1(1,1);
Please let me know what could go wrong with it.
Many thanks in advance.
Andras
1 Comment
Stephen23
on 8 Aug 2019
Andras Gergely's incorrectly accepted "Answer" moved here:
Dear Walter Robinson and John D'Errico,
Now it works but anyway I cannot comprehend why yesterday it would not work despite I refered to and checked with the inbuilt help function.
Sorry for the inappropriate postage.
Best wishes,
Andras
Accepted Answer
More Answers (1)
Walter Roberson
on 8 Aug 2019
1 vote
With the exception of the case where the numerator or denominator are scalars, rdivide() before R2016b requires that the numerator and the denominator are exactly the same size. As of R2016b, rdivide() instead requires that the numerator and denominator are "compatible" sizes, as-if you had done bsxfun(@rdivide, Numerator, Denominator) . So for example if the numerator were 5 x 7 and the denominator were 5 x 1, then that would be considered compatible because it the 5 x 1 denominator would get implicitly extended to 5 x 7.
The situation is different for the function mrdivide(), which does not require that the numerator and denominator are exactly the same size or are compatible sizes, and instead requires that the numerator and denominator have the same number of columns.
Note that rdivide() is the formal name of the ./ function for element-by-element division, and that mrdivide() is the formal name for the / function for solving systems of linear equations.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!