Potential subjects for an experiment that are stored in a vector:

1 回表示 (過去 30 日間)
Nora
Nora 2013 年 10 月 20 日
>> subjects subjects = 1x3 struct array with fields: name sub_id height weight >> subjects(1) ans = name: 'Joey' sub_id: 111 height: 6.7000 weight: 222.2000
As an example, you can create the following vector of subjects in your command window: subjects(4) = struct('name','Mary','sub_id',363,'height',5.1,'weight',110); subjects(1) = struct('name','Joey','sub_id',111,'height',6.7,'weight',222.2); subjects(2) = struct('name','Pat','sub_id',221,'height',5.9,'weight',165); subjects(3) = struct('name','John','sub_id',201,'height',5.2,'weight',155);
For this particular experiment, the only subjects who are eligible are those whose height or weight is lower than the average height or weight of all subjects. Write a function that takes this vector as input argument. The function will examine all records and print the names of those who are eligible. Don’t assume that the length of the vector is known; the code should be general.

回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by