I am familiar with python, but this is only my second day using matlab.
I understand that
a = {1 2 3}
fprintf('%i %i %i', a{1:3})
yields
1 2 3
But how come
a = {1 2 3}
fprintf('%i %i %i', a)
gives an error?
I would really like for
fprintf('%i %i %i', {1 2 3}{1:3})
to yield
1 2 3
In other words, if I have a cell array, how do I print each element with fprintf without assigning the cell array to a variable?
Any advice is appreciated.
EDIT: To elaborate: I have a challenge set to receive user input to get the name of an experiment, current date, and end date (of the experiment) and then output all of this information as well as the number of days left until the experiment concludes. I want to do this with only one line of code. My code is as follows.
fprintf(strcat(...
'\nTest: %s',...
'\nCurrent Date: %s',...
'\nEnd Date: %s',...
'\nNumber of days until completion: %i\n'...
),input('\nTest name?\n','s'),...
feval(@(dates){dates{1},dates{2},diff(datenum(dates,'mm-dd-yyyy'))},...
{input('\nCurrent Date? (mm-dd-yyyy)\n','s')...
input('\nEnd Date? (mm-dd-yyyy)\n','s')}));
When this code is run I receive an error that essentially boils down to the problem described above, but I wanted to stick to basic examples. This should clear up why I don't want to just use a variable defined previously - there is no previously defined variable.