--- matlab.el	2017-11-08 12:51:31.383623975 -0500
+++ matlab-new.el	2017-10-17 11:34:44.739044723 -0400
@@ -71,7 +71,7 @@
       (defalias 'matlab-cancel-timer 'delete-itimer)
       (defun matlab-run-with-idle-timer (secs repeat function &rest args)
 	(condition-case nil
-	    (apply 'start-itimer
+:	    (apply 'start-itimer
 		   "matlab" function secs
 		   (if repeat secs nil) t
 		   t (car args))
@@ -5412,15 +5412,14 @@
       ;; We are done error checking, run the command.
       (setq pos (point))
       (comint-simple-send (get-buffer-process (current-buffer))
-			  (concat command "\n"))
+			  command)
       ;;(message "MATLAB ... Executing command.")
       (goto-char (point-max))
-      (while (or (>= (+ pos (string-width command)) (point)) (not (matlab-on-empty-prompt-p)))
-	(accept-process-output (get-buffer-process (current-buffer)))
-	(goto-char (point-max))
-	;;(message "MATLAB reading...")
-	)
-      ;;(message "MATLAB reading...done")
+      (with-local-quit
+       (while (or (>= (+ pos (string-width command)) (point))
+		  (not (matlab-on-empty-prompt-p)))
+	 (accept-process-output (get-buffer-process (current-buffer)))
+	 (goto-char (point-max))))
       (save-excursion
 	(goto-char pos)
 	(beginning-of-line)
