I am the happy user of matlab mode.  However, for some time I have
experienced a problem/bug.  When I edit a m-file and have matlab-shell
running emacs gets stuck and uses on full CPU when i pass strings
inside functions.  For example the below,

  y(i,:)= sum(x((1:r)+(i-1)*r,:))/r;

when the cursor pass x emacs use one full CPU until I enter ctrl-G
then the *MATLAB* buffer says

>> which xpsound
/usr/local/MATLAB/R2014a/toolbox/matlab/demos/xpsound.m
>>

if I then continue and pass r *MATLAB* says

>> which randnv
/home/tk/Matlab/MFiles/randnv.m
>>
>>

I use
>> version

ans =

8.3.0.532 (R2014a)

And also a path included above together with the m file I was
writing.

Any help is appreciated.


Associate Prof. Ph.D Torben Knudsen    Mobile    : (+45) 2787 9826
Section of Automation and Control,
Department of Electronic Systems,    Email    : t...@es.aau.dk
Aalborg University              Web    : es.aau.dk/staff/tk
Fredrik Bajersvej 7
DK-9220 Aalborg Ø
Denmark
*** matlab.el.~1.40.~	2013-08-22 08:48:51.000000000 -0400
--- matlab.el	2014-09-19 12:36:15.778112000 -0400
***************
*** 1059,1065 ****
     '("^\\(Error in\\|Syntax error in\\)\\s-+==>\\s-+\\(.+\\)$"
       (1 font-lock-comment-face) (2 font-lock-string-face))
     ;; and line numbers
!    '("^\\(On line [0-9]+\\)" 1 font-lock-comment-face)
     ;; User beep things
     '("\\(\\?\\?\\?[^\n]+\\)" 1 font-lock-comment-face)
     ;; Useful user commands, but not useful programming constructs
--- 1059,1065 ----
     '("^\\(Error in\\|Syntax error in\\)\\s-+==>\\s-+\\(.+\\)$"
       (1 font-lock-comment-face) (2 font-lock-string-face))
     ;; and line numbers
!    '("^\\(\\(On \\)?line [0-9]+\\)" 1 font-lock-comment-face)
     ;; User beep things
     '("\\(\\?\\?\\?[^\n]+\\)" 1 font-lock-comment-face)
     ;; Useful user commands, but not useful programming constructs
***************
*** 4613,4622 ****
  ;; Syntax:  Syntax error in ==> <filename>
  ;;          On line # ==> <sample-text>
  ;; Warning: In <filename> at line # <stuff>
  (defvar gud-matlab-error-regexp
!   (concat "\\(Error \\(?:in\\|using\\) ==>\\|Syntax error in ==>\\|In\\) "
! 	  "\\([-@.a-zA-Z_0-9/ \\\\:]+\\)\\(?:>[^ ]+\\)?.*[\n ]\\(?:On\\|at\\)\\(?: line\\)? "
! 	  "\\([0-9]+\\) ?")
    "Regular expression finding where an error occurred.")
  
  (defvar matlab-shell-last-error-anchor nil
--- 4618,4636 ----
  ;; Syntax:  Syntax error in ==> <filename>
  ;;          On line # ==> <sample-text>
  ;; Warning: In <filename> at line # <stuff>
+ ;;
+ ;; New Error Formats:
+ ;; Errors:  Error in <function name> (line <#>)
  (defvar gud-matlab-error-regexp
!   (if t
!       (concat "\\(Error \\(?:in\\|using\\)\\|Syntax error in\\) "
!               "\\([-@.a-zA-Z_0-9/\\\\:]+\\)[\n ]*(line "
!               "\\([0-9]+\\)) ?")
!     ;; else
!     (concat "\\(Error \\(?:in\\|using\\) ==>\\|Syntax error in ==>\\|In\\) "
!             "\\([-@.a-zA-Z_0-9/ \\\\:]+\\)\\(?:>[^ ]+\\)?.*[\n ]\\(?:On\\|at\\)\\(?: line\\)? "
!             "\\([0-9]+\\) ?")
!     ) ;; end if
    "Regular expression finding where an error occurred.")
  
  (defvar matlab-shell-last-error-anchor nil
function [y,t]= DecimateWMA(x,r,c)
%DecimateWMA Decimate the matrix column by column using a moving average
% FIR filter of length r
%
% [y,yi]= DecimateWMA(x,r)
%
% x : Matrix (nxm) with columns to be decimated
% r : Length of MA filter
% y : Decimated matrix (floor(n/r)xm)
% t : Index/time vector corresponding to the original index/time for x
% 
% External input: None

% Time-stamp: <2014-10-14 09:16:57 tk>
% Version 1: Initial version
% Torben Knudsen
% Aalborg University, Dept. of Electronic Systems, Section of Automation
% and Control
% E-mail: t...@es.aau.dk

%% setting up inputs
if nargin < 2; error('Error TK: To few input arguments'); end;

%% Parameters

%% Definitions etc.

%% Algorithm

% Only use integer number off r rows
[n,m]= size(x);
ny= floor(n/r);
x= x(1:ny*r,:);

% Directly calculate the output
y= zeros(ny,m);
for i= 1:ny;
  y(i,:)= sum(x((1:r)+(i-1)*r,:))/r;
end
t= (1:ny)*r;
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Matlab-emacs-discuss mailing list
Matlab-emacs-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss

Reply via email to