how to create a border using cell arrays

1 Ansicht (letzte 30 Tage)
Mitchie Teotico
Mitchie Teotico am 27 Mär. 2020
Kommentiert: Adam Danz am 27 Mär. 2020
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 Kommentar
Adam Danz
Adam Danz am 27 Mär. 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} =
% *****

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Operators and Elementary Operations 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!

Translated by