Hii,
MATLAB workspace variables will be deleted after exiting ,so you will not be able to access variable ‘P’. Moreover ‘P’ is a graphics array, so you can’t get pie chart from variable ‘P’. Instead you can save data for which you want pie chart in a variable (a=[1 2 3]),save it to .mat file using save. After reopening MATLAB you can load .mat file using load. Then use command pie(a),to get pie chart.
You can use below line of code for same:
p=[1 2 3]
save("variables.mat")
After initialising matlab:
load("variables.mat")
pie(p)
Refer to below links: