필터 지우기
필터 지우기

how to assign array values at running time in matlab

조회 수: 1 (최근 30일)
live to l e a r n  MATLAB
live to l e a r n MATLAB 2012년 9월 22일
for example this my c code and how can i write in matalb
main( )
{
int avg, sum = 0 ;
int i ;
int marks[30] ; /* array declaration */
for ( i = 0 ; i <= 29 ; i++ )
{
printf ( "\nEnter marks " ) ;
scanf ( "%d", &marks[i] ) ; /* store data in array */
}
for ( i = 0 ; i <= 29 ; i++ )
sum = sum + marks[i] ; /* read data from an array*/
avg = sum / 30 ;
printf ( "\nAverage marks = %d", avg ) ;
}
  댓글 수: 1
live to l e a r n  MATLAB
live to l e a r n MATLAB 2012년 9월 22일
Am asked about how to store the dates in array while running time, read data from an array
in c we have
for ( i = 0 ; i <= 29 ; i++ ) { printf ( "\nEnter marks " ) ; scanf ( "%d", &marks[i] ) ; /* store data in array / } for ( i = 0 ; i <= 29 ; i++ ) sum = sum + marks[i] ; / read data from an array*/
avg = sum / 30 ; printf ( "\nAverage marks = %d", avg ) ; }
it means my question is this are my elements 1 8 9 12 15 .and now how write and read in arrays

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

채택된 답변

Walter Roberson
Walter Roberson 2012년 9월 22일
See input(); see also questdlg() and uicontrol()

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by