mazispatzi

10 Reputation

One Badge

7 years, 155 days

MaplePrimes Activity


These are replies submitted by mazispatzi

Dear @tomleslie,

thanks a lot for your detailed answer and your very appreciated help.

I was looking for exactely this line of your example:

b:=[seq( seq( `if`(A[i,j]<>0,a[i,j]=A[i,j], NULL), i=1..op([1,1],A)),j=1..op([1,2],A))];

I just replaced op([1,1],A) with RowDimension(A) and op([1,2],A) with ColumnDimension(A), but apart from that it works as expected.

Regarding the symbolic expressions, I know from Maple which variables are used and initilialise appropriate symbolic vectors in MATLAB before reading the text file.

Btw, not exporting the zero lines gives an improvement by more than 30% in terms of execution time. Thats quite nice for one line of code.

Thanks again!

@tomleslie Thank you very much for your answer!

I tried the ExportMatrix command but its doesnt really work as its indicates that it cannot convert non-numeric values. (Its a symbolic expression). However, it also would not solve my initial problem.

Regarding your comment: I do care of few hundrets redundant lines, because it takes a lot of time to write to the file. There is no point of writing hundrets and hundrets of lines to a file that are not used anyway ...

Any other suggestions to solve the problem?

Many thanks!

 

 

Page 1 of 1