Anup,

 
>
>> 1. if the way of writing the sparse matrix on a .txt file is appropriate 
>> for post-processing in matlab, if not, please suggest
>> a way;
>>
>
> There are three print functions in the deal.II SparseMatrix. As explained 
> in the documentation 
> <https://www.dealii.org/developer/doxygen/deal.II/classSparseMatrix.html#af38b1c3e6200698c3d9ea5577436c61c>,
>  
> you've chosen one that dumps the entire matrix with all zero entries not in 
> the sparsity pattern printed as well. This function 
> <https://www.dealii.org/developer/doxygen/deal.II/classSparseMatrix.html#a57ee42a70d603759e17b8a204af3c4d5>
>  
> is probably the one that you want.
>
In addition to what J-P is saying, you can use 
SparseMatrix::print_formatted providing the zero string "0." instead of "" 
for exporting to some file "matrix.txt" and then load "matrix.txt" in 
Matlab.
  

>  
>
>> 2.  how should I make matlab understand the size of the sparse matrix and 
>> arrangement of the elements.
>>
> Using SparseMatrix::print you get a list of entries starting at zero 
instead of one. You can use the "Import Data" feature with suitable 
delimiters "( " and ")"
to create a matrix in Matlab,
load "matrix.txt"
shift the first two columns by 1 via
matrix(:,1)=matrix(:,1)+1
matrix(:,2)=matrix(:,2)+1
and convert this to a sparse matrix via
spconvert(matrix)

Best,
Daniel

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to