print first element of cell to screen using fprintf in matlab

main.m
% Tags: matlab, cell arrays, fprintf, indexing

% creating a sample cell array
myCell = {'apple', 'banana', 'cherry'};

% printing the first element of the cell to the screen
fprintf('%s\n', myCell{1});
203 chars
8 lines

Output:

main.m
apple
6 chars
2 lines

gistlibby LogSnag