MATLAB: How to save the result of stlwrite to a specific directory chosen by the user

saving directorystlstlwrite

I am using the stlwrite to create an stl file out of a triangulted input, say for example I use f3 and v3 which are faces and verticies to create a triangulation and then convert that into stl. The stl saves in the same directory as code. I would like to have the option to ask the user of my code to chose a certain directory to save the file. how do I do that ?
TR = triangulation(f3,v3);
stlwrite(TR,'G.stl');
I am not sure I understand how uiputfile works.

Best Answer

TR = ...
[F,P] = uiputfile('*.stl');
stlwrite(TR,fullfile(P,F))