Subscript indices must either be real positive integers or logicals
    6 ビュー (過去 30 日間)
  
       古いコメントを表示
    
i am trying to add column of a large matrix using sum instruction but is getting this error "Subscript indices must either be real positive integers or logicals." kindly suggest me a way out
q =
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
    55    21
    57    19
    57    19
    57    19
    56    20
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    11    65
    10    66
    11    65
    11    65
    11    65
    11    65
    10    66
    10    66
     9    67
     9    67
     8    68
     8    68
     7    69
     6    70
     6    70
     5    71
     5    71
     3    73
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
     0    76
>> pri=sum(q)
Subscript indices must either be real positive integers or logicals.
0 件のコメント
回答 (2 件)
  Azzi Abdelmalek
      
      
 2013 年 7 月 21 日
        You have probably used sum as a variable in your code. Check it by typing
sum
0 件のコメント
  Image Analyst
      
      
 2013 年 7 月 21 日
        You probably redefined sum to be a variable or function in your code, thus destroying it, or actually just using yours in preference to the built-in sum() function. Try putting these lines in and seeing what it says.
whos sum
which -all sum
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!