フィルターのクリア

Is my code for this assignment correct?

1 回表示 (過去 30 日間)
Eduardo Gallegos
Eduardo Gallegos 2022 年 12 月 7 日
コメント済み: Eduardo Gallegos 2022 年 12 月 7 日
Hi everyone, I'm unsure if this the correct way to do what the assignment is asking.
ASSIGNMENT
Make a cell array called South_American_Countries.
You can find a link to these countries at List of South American CountriesLinks to an external site.
In this list, the countries to put in your cell array are called "Sovereign states".
Do not include the territories, which are listed below the Sovereign states.
The add this code to display the 3rd and 7th countries in your cell array:
South_American_Countries{3} % Note that you need squiggly brackets to access members of a cell array.
South_American_Countries{7}
(If your cell array has a different name, use that name.)
CODE
Soverign_States = cell (1,11)
Soverign_States(1,1) = cellstr('Argentina')
Soverign_States(1,2) = cellstr('Bolivia')
Soverign_States(1,3) = cellstr('Brazil')
Soverign_States(1,4) = cellstr('Chile')
Soverign_States(1,5) = cellstr('Colombia')
Soverign_States(1,6) = cellstr('Ecuador')
Soverign_States(1,7) = cellstr('Guyana')
Soverign_States(1,8) = cellstr('Peru')
Soverign_States(1,9) = cellstr('Suriname')
Soverign_States(1,10) = cellstr('Uruguay')
Soverign_States(1,11) = cellstr('Venezuela')
Soverign_States{1,1}
  2 件のコメント
Voss
Voss 2022 年 12 月 7 日
You forgot Paraguay.
Eduardo Gallegos
Eduardo Gallegos 2022 年 12 月 7 日
Thank you for checking my work.

サインインしてコメントする。

採用された回答

Voss
Voss 2022 年 12 月 7 日
You can construct a cell array more directly than that (which is not to say your approach is "incorrect"):
S = {'Argentina' 'Bolivia' 'Brazil'} % etc.
S = 1×3 cell array
{'Argentina'} {'Bolivia'} {'Brazil'}
S{3}
ans = 'Brazil'
  1 件のコメント
Eduardo Gallegos
Eduardo Gallegos 2022 年 12 月 7 日
Thank you for the advice.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by