Clear Filters
Clear Filters

How to write a program which gives output in form of table for students grade and each time i run the program the marks for each student should change randomly?

1 view (last 30 days)
Need the program like this type
Student1= 'any random name'
%random marks
marks1= randi(100,1)
%assigning grade
if marks1<100 & marks1>=90
grade1= 'A'
....
end
% NOW THE MAIN PART DISPLAYING THE OUTPUT IN FORM OF TABLE FOR 10 STUDENTS
?????
  1 Comment
Dyuman Joshi
Dyuman Joshi on 21 May 2022
What have you tried yet? What is the problem/error you are facing? Did you try a simple search on the internet to find any similar problems? Because there are many similar questions just on this forum alone that have been answered!
Don't expect anyone here to write full code for you.

Sign in to comment.

Answers (1)

Chandra
Chandra on 24 May 2022
Hi,
Please refer to writetable function
example
LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];
T = table(Age,Height,Weight,BloodPressure,...
'RowNames',LastName)
writetable(T,'myPatientData.dat','WriteRowNames',true)

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!