- remove the semi-colons (not recommended)
- use an explicit disp command, e.g. disp(x).
- use debugging tools to track variables.
- change the script to a function and return some outputs.
Problem with running m file
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tatjana Simcevic
am 18 Aug. 2015
Bearbeitet: Stephen23
am 18 Aug. 2015
When I run a very simple m (prob.m ) file as: x = 1; y = 2; z= x+y;
I get the right answer in the workspace, but the command window just says the name of the file. What am I doing wrong?
1 Kommentar
Akzeptierte Antwort
Stalin Samuel
am 18 Aug. 2015
remove ; from end of each commands
1 Kommentar
John D'Errico
am 18 Aug. 2015
Note that this is arguably a very bad answer. It teaches the user to remove semi-colons from their lines, thus dumping large amounts of crap to the screen. That same user will then need to RELEARN to put semi-colons on their lines.
Instead, a far better answer would have suggested returning some arguments from the function, teaching what a function is and how it works. An answer might have suggested using the display/diap tools to dump SOME information to the screen as they might desire.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices 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!