How can I write a function that gives out a matrix with the specified rows and columns?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Jan
am 27 Okt. 2014
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.
Antworten (2)
per isakson
am 28 Okt. 2014
Bearbeitet: per isakson
am 28 Okt. 2014
Your function as of the comment works nicely
>> s = getfancyrectangle( 4, 5 )
s =
@#@#@
#@#@#
@#@#@
#@#@#
0 Kommentare
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!