How can I write a function that gives out a matrix with the specified rows and columns?
2 ビュー (過去 30 日間)
古いコメントを表示
Write a function getfancyrectangle(R,C) that takes the number of rows and columns and returns a string as a character matrix, containing a "fancy" rectangle filled with alternating '@' and '#' characters.
For example:
R=2
C=3
@#@
#@#
2 件のコメント
Jan
2014 年 10 月 27 日
This is obviously a homework question. As usual we will not solve it for you, such that you keep the chance to submit a solution without cheating.
Better post, what you have tried so far and ask a specific question.
回答 (2 件)
per isakson
2014 年 10 月 28 日
編集済み: per isakson
2014 年 10 月 28 日
Your function as of the comment works nicely
>> s = getfancyrectangle( 4, 5 )
s =
@#@#@
#@#@#
@#@#@
#@#@#
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!