am using matlab R2015a while running program or after running program i couldn't do sum(A) where A is an column/row array

조회 수: 1 (최근 30일)
Pl =[ 0.02
0
0.06
0.04
0
0.35
0.03
0.15
0.13
0.02
0.2
0.01
0.02]
Pl is one of the variable, now i want to add all the elements of Pl
so i did sum(Pl) <<< well known syntax to add elements of an array
>> sum(Pl)
now below is the error it was showing
Subscript indices must either be real positive integers or logicals. can any one plz let me know... and one more thing after completion of program if i put cursor on any variable it is showing that variable values/array/matrix like how we normally see while debugging

채택된 답변

Birdman
Birdman 2017년 12월 28일
편집: Birdman 2017년 12월 28일
You might have another function called sum in your current directory and shadowing the built-in function sum. Please check it.
  댓글 수: 3
POLURI SRIMANNARAYANA
POLURI SRIMANNARAYANA 2017년 12월 28일
thank you sir......got it... i have used ' sum ' as a variable for summation purpose in the ' for ' loop mistakenly.....

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

추가 답변 (0개)

카테고리

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