intro to analytical programming -Matlab
1 次查看(过去 30 天)
显示 更早的评论
We collect data for different type of milk. The data is recorded in a table T, with columns:
Country = [“CA”; “CA”; “US”;…]
state = [“ON”; “BC”; “OHIO”,…]; # province or state
fat= [1; 2; 3;…]; # fat percentage in %
quality = [2; 1; 5; …]; # the larger the better quality.
- Code to view the data for “CA” (Canada)
- Code to add one new type of milk, from MB, Canada, fat percentage is 10%, and quality is 4.
- Code to update the “state” column, change “BC” to “AB”.
- Code to find which milk has quality greater than 4.
- Code to find which milk has quality greater than 4 and from “ON”.
回答(1 个)
Monisha Nalluru
2020-10-29
For my understanding, you can select the required content Boolean Indexing
As an example
load patients.mat
T = table(Gender,Smoker,Height,Weight);
NewTable= T(T.Smoker==true,:) % return all the rows having Smoker = true
Similarly change according to usecase
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Report Generator 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!