Can i undo command in command window?

조회 수: 34 (최근 30일)
Gonzalo Lerner
Gonzalo Lerner 2015년 12월 31일
댓글: Star Strider 2015년 12월 31일
Hi there. I'm new to Matlab and i'm learning it's usage with a book that contains exercises. Sometimes it happens that i create a matrix and make several changes to it through different exercises.
If i do something wrong at some point and change the matrix in a way that i shouldn't have. Is there a way of undo only the last command? Or do i have to change the matrix step by step all over again?

채택된 답변

Star Strider
Star Strider 2015년 12월 31일
If you’re doing everything in the Command Window, there is no going back.
I would open and save a script file for your exercises and run the script file instead. You can Comment (use % in the first column) the lines you want to save but do not want to run for later reference as you go through your textbook. (I have a script file like that to test and save code I post here on Answers.) You can also use comments to refer to specific exercises on specific pages with respect to your code, so you can refer to it later.
  댓글 수: 3
Image Analyst
Image Analyst 2015년 12월 31일
As a companion to writing scripts, you'll definitely need to look at this link to learn essential skills in debugging them.
Star Strider
Star Strider 2015년 12월 31일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2015년 12월 31일
편집: Sean de Wolski 2015년 12월 31일
You can use the command history to extract all of the "correct" commands that you've run to create a script. Press the up arrow, or type commandhistory and it will pull it up. From there, you can copy or run ("Evaluate Selection") what you want.
I'd also recommend docking your command history if it's not docked already.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by