Functions for structure array
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I get how to many a structure array in the command window but I am kind of lost of how to write the function for it. Mostly the function header. I need to make a structure of students that have the inputs of name, id, and grades. I need to have a 1x1 structure of newStudents and then populate a 1x5 stucture of students.
would it be correct to write
function [student] = student
student = [student,newStudent];
and then fill it? Please help
0 Commenti
Risposte (1)
Matt J
il 10 Set 2014
There are a few ways. Here is the most direct,
>> student=struct('name',{'George','Mary','Steve','Susan','Ralph'},'grade',{'A','A+','F','A-','B'})
student =
1x5 struct array with fields:
name
grade
0 Commenti
Vedere anche
Categorie
Scopri di più su Structures in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!