I tried many times but can't get solution....plz help me
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
"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 Kommentare
Walter Roberson
am 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
am 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.
Antworten (1)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!