Geting a Unexpected MATLAB expression , for my function but works fine on the console
    6 ビュー (過去 30 日間)
  
       古いコメントを表示
    
function w flip_it(v)
    % This function just flips elements from all the rows and columns of a input matrix v...
    % Inputs: 
    % v = some input Matrix/Vector of unknown dimensions
    % Outputs:
    % w = A Matrix containing all rows and column elements flipped from the input matrix ..
    % w  =  v(end:-1:1,end:-1:1);   %used end too but of no avail.. 
      [vrows,vcols] = size(v);
      w  =  v(vrows:-1:1,vcols:-1:1);
end
% does not show any error on the editor and also it works fine on the console % as a MATLAB newbie what am I doing wrong ?
0 件のコメント
回答 (2 件)
  dpb
      
      
 2016 年 9 月 2 日
        
      編集済み: dpb
      
      
 2016 年 9 月 4 日
  
      function w=flip_it(v)
I'm more than surprised there's no flag in the editor and/or that it could run as is w/o the missing '=' sign on the function statement
ADDENDUM
OK, I did enter your function in the editor and the parsing is somewhat different than I expected (but see what happened and makes sense when read the comment...
For the line
function w flip_it(v)
there are two comments; the first of which is "Function w is known to Matlab by the file name flip_it.m" followed by a second noting there's no separator before the reference to flip_it(v).
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Matrix Indexing についてさらに検索
			
	製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!