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

1 次查看(过去 30 天)
"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