Hi Jiaqi,
I suggest you to go through MATLAB onramp course https://www.mathworks.com/learn/tutorials/matlab-onramp.html , which provides all the necessary details to quick start programming in MATLAB.
For your question, the following links can help you write the code:
Follow the above links and you could come up with a similar output code as below:
function StudentInfo()
details = cell(4,1);
details{1} = input('Please enter the First Name:','s');
details{2} = input('Please eneter the Last Name:','s');
details{3} = input('Please enter the ID:','s');
details{4} = input('Please enter the GPA:','s');
% Display the details
disp("Name: " + cellstr(details{1}) + " " + cellstr(details{2}))
disp("UID: " + num2str(details{3}))
disp("GPA: " + num2str(details{4}))
end
Hope this helps.
Regards,
Sriram
