how to create a border using cell arrays
2 views (last 30 days)
Show older comments
I am trying to create a function that inputs a number of rows (float,scalar) number of columns
(float scalar) and a character to be used for the border of a card the function should then
set up the blank flash cards and outputs it into a cell array the function then sets up the
blank flash cards and outputs it in a cell array (Nx1) like the one shown bellow.
im given the format and how the output should look like but i dont know how what to put in
the middle so that it outputs a border.
c = blankCard(5,5,’*’)
c = {
[1,1] = *****
[1,2] = * *
[1,3] = * *
[1,4] = * *
[1,5] = *****
}
1 Comment
Adam Danz
on 27 Mar 2020
The question describes an Nx1 cell array but the example shows a 1XN cell array if I'm interpretting the indices correctly.
More importantly, the cell would not display like the example in your question.
% Create the array
c = {
{'*****'};
{'* *'};
{'* *'};
{'* *'};
{'*****'};
};
size(c)
% ans =
% 5 1
% Display C
>> c
% c =
% 5×1 cell array
% {1×1 cell}
% {1×1 cell}
% {1×1 cell}
% {1×1 cell}
% {1×1 cell}
% Display cell content
>> celldisp(c)
% c{1}{1} =
% *****
% c{2}{1} =
% * *
% c{3}{1} =
% * *
% c{4}{1} =
% * *
% c{5}{1} =
% *****
Answers (0)
See Also
Categories
Find more on Workspace Variables and MAT-Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!