Intellectual Property (IP) is an ensemble of rights related to inventions and other creations of the mind. It includes mainly patents, copyrights and trademarks.
The purpose of IP in the academic context is to be utilized as a tool to protect research results, with the ultimate goal of transferring them to industry. This protection is often an important criterion in the decision of a business partner to invest in the development of a technology or a commercial product based on academic research results.
Publish or Patent? One does not exclude the other, it is just important to get the timing right. That means filing a patent application before publishing.