I tried many times but can't get solution....plz help me

조회 수: 1 (최근 30일)
Darshan Kanungo
Darshan Kanungo 2015년 6월 6일
답변: charu sharma 2015년 8월 27일
"Write a function called sparse_array_out that takes two input arguments and returns one output argument. Its first argument is a two-dimensional array of doubles, which it writes into a binary file. The name of that file is the second argument to the function. The file must have the following format. It starts with three uint32 scalars specifying the number of rows of the array followed by the number of columns followed by the number of non-zero elements in the array. Then each non-zero element of the array is represented by two uint32 scalars and a double scalar in the file in this order: its row index (uint32), its column index (uint32), and its value (double). Note that this file format is an efficient way to store a so-called “sparse array”, which is by definition an array for which the overwhelming majority of its elements equal 0. The function’s output argument is of type logical and equals false if there was a problem opening the file and true otherwise."
this must be output of this problem
sparse_array_out(M, 'test.bin')
ans =
1
  댓글 수: 3
Walter Roberson
Walter Roberson 2015년 6월 6일
So you read the question and it looked like you might have to read the documentation, so you decided you would ask us to post the code to solve your homework assignment?
Guillaume
Guillaume 2015년 6월 8일
You'll have to explain why you can't get the solution and which particular bit is tripping you up, because the solution only requires about 5 lines of code.

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

답변 (1개)

charu sharma
charu sharma 2015년 8월 27일

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by