Camilla, the chancellor of the University of Aberdeen, did the honours at the laboratory at its Foresterhill campus.
The laboratory forms part of the university's Rowett Institute, which has been at the forefront of nutritional science for more than a century.
During her visit, the Duchess toured the Human Nutrition Unit, meeting staff, students and volunteers to hear about some of the research taking place at the facility.
Camilla, Duchess of Cornwall, has opened a new research lab in the University of Aberdeen
Camilla represents the Queen for the first time at Sandhurst’s parade
Camilla plays fairy godmother of boy in video for 500 words writing…
I am absolutely delighted that we have officially opened this wonderful new building
Professor Peter Morgan
Current research includes whether the taste buds of babies can be influenced while they are still in the womb, if it is possible to stop unhealthy food choices becoming a habit, and the possibility of creating a healthier Scotch pie.
Rowett Institute director Professor Peter Morgan said: "I am absolutely delighted that we have officially opened this wonderful new building.
"The Rowett Institute has been a leading force in nutrition research for many years, and as time has gone on the importance of creating a world-class facility to match our global reputation has been paramount.
The laboratory forms part of the university's Rowett Institute
"An essential part of being able to provide this fantastic new building was the underpinning funding the Rowett receives for research from the Scottish Government, specifically from the Rural and Environment Science and Analytical Services Directorate, and we are hugely grateful for their support."
Deputy First Minister John Swinney added: "I am delighted that the Scottish Government has helped to enable these new state-of-the-art facilities through our investment of £12 million.
Prince Charles & Camilla in pictures
Mon, January 16, 2017
The Prince of Wales, Prince Charles, and Duchess of Cornwall royal visits and encounters across the globe.
PA Archive/PA Images
1 of 159
The Duchess of Cornwall with actor Tom Hiddleston at a reception following the live broadcast of the final of BBC Radio 2's 500 Words creative writing competition at Shakespeare's Globe in London.
The Duchess toured the Human Nutrition Unit
"Aberdeen is already at the very cutting edge of food and health-related research, contributing to Scotland's global reputation for research excellence and attracting some of the brightest and best researchers from across the world.
"The Rowett Institute's move into the University of Aberdeen and the establishment of a purpose-built Human Nutrition Unit, the most advanced facility of its kind in the UK, will build on this success, strengthening its capacity to pioneer new research and increasing its international competitiveness and opportunities for collaboration."