You may be thinking of The Great Santini (1979), starring Robert Duvall as Marine fighter pilot Lt. Col. "Bull" Meecham. Walter Matthau appears as Sergeant Major, a gruff drill instructor—not as a lead opposite a wealthy woman. Bull's wife, Mary Anne (Blythe Danner), is portrayed as strong and independent, but she's not the central figure of a Matthau vehicle.
No Walter Matthau film centers on a rich woman as the main character.