x = rand; s = 'The number %g is %s than 0.5\n'; if x<0.5 fprintf(s,x,'less') else fprintf(s,x,'more') end