Please help if you can
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Can you make matlab give answers in line with "ans = " , here is a photo(adress bellow text) of what i need , if this is possible please tell me how to do that. Thanks in advance http://imageshack.us/photo/my-images/28/42343019.jpg/
1 Kommentar
Akzeptierte Antwort
Oleg Komarov
am 29 Feb. 2012
It's not complicated to explain but it's quite annoying to implement. Have you tried my example in a comment to Sean's asnwer fprintf('\b %f',3)?
ans =
...
Is a message displayed (or printed) in the command window. To display something different from the standard behaviour requires you to use some specific functions that allow customization.
However, these functions (sprintf and fprintf) are not so flexible to adapt automatically to every situation while a consistent implementation of the customization would require to preserve the root formatting and to discriminate between variable types.
Thus you need to check the variable type and the root format, then you need to decline your customized formatting for each combination of the two above.
3 Kommentare
Weitere Antworten (3)
Sean de Wolski
am 28 Feb. 2012
doc fprintf
1 Kommentar
Oleg Komarov
am 28 Feb. 2012
fprintf('\b %f',3)
This option obviously doesn't consider the get(0,'format') in use and the type of variable.
Thus, as Walter says, it is possible but would require quite some coding, which honestly IMO is in general not justified (and specifically in this case, since the OP did not motivate the use of it).
Walter Roberson
am 28 Feb. 2012
It is possible in theory: you can overwrite the method named "display". Which can be a big nuisance to do, but it is possible.
0 Kommentare
Milos Ivankovic
am 29 Feb. 2012
2 Kommentare
Jan
am 29 Feb. 2012
You can fake it by using "input('>> ', 's'); disp('ans = '); eval(S), input('>> ', 's');". I cannot check this currently, but it should look like a real command line output.
Siehe auch
Kategorien
Mehr zu Dates and Time 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!