All pastes #2089668 Raw Edit

Untitled

public text v1 · immutable
#2089668 ·published 2011-10-13 09:54 UTC
rendered paste body
%4 задание
clc, clear all

student = struct('last_name', 'Фамилия1', 'first_name', 'Имя1', 'father_name', 'Отчество1', 'math', '4', 'phys', '4');
student.last_name = char(student.last_name,'Фамилия2');
student.last_name = char(student.last_name,'Фамилия3');
student.first_name = char(student.first_name,'Имя2');
student.first_name = char(student.first_name,'Имя3');
student.father_name = char(student.father_name,'Отчество2');
student.father_name = char(student.father_name,'Отчество3');
student.math = char(student.math,'5');
student.math = char(student.math,'3');
student.phys = char(student.phys,'4');
student.phys = char(student.phys,'4');
student = orderfields(student)

 stud.student1.last_name='Фамилия1';
 stud.student2.last_name='Фамилия2';
 stud.student3.last_name='Фамилия3';
 stud.student1.first_name='Имя1';
 stud.student2.first_name='Имя2';
 stud.student3.first_name='Имя3';
 stud.student1.father_name='Отчество1';
 stud.student2.father_name='Отчество2';
 stud.student3.father_name='Отчество3';
 stud.student1.math=4;
 stud.student2.math=5;
 stud.student3.math=3;
 stud.student1.phys=4;
 stud.student2.phys=4;
 stud.student3.phys=4;
 
 student = orderfields(student)
 stud = orderfields(stud)
  
 str1=[stud.student1.last_name, '  ', stud.student1.first_name, ' ',stud.student1.father_name, ' ' num2str((stud.student1.math + stud.student1.phys)/2)]
 str2 = [stud.student2.last_name, '  ', stud.student2.first_name, ' ',stud.student2.father_name, ' ' num2str((stud.student2.math + stud.student2.phys)/2)]
 str3 = [stud.student3.last_name, '  ', stud.student3.first_name, ' ',stud.student3.father_name, ' ' num2str((stud.student3.math + stud.student3.phys)/2)]