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

1 view (last 30 days)
"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 Comments
Walter Roberson
Walter Roberson on 6 Jun 2015
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 on 8 Jun 2015
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.

Sign in to comment.

Answers (1)

charu sharma
charu sharma on 27 Aug 2015

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!