How to save obtained information from matlab in Excel

2 views (last 30 days)
I want to create some random matrices and compute some features like determinant, trace, etc., for them and then save them in a row for each matrix like this
I know how to create random matrices with rand(A) and how to compute their features by matlab but my question is that how can I save my obtained information in Excel.
I was wondering if someone could help me about my problem.
Thanks in advance.

Accepted Answer

Benjamin Kraus
Benjamin Kraus on 4 Jun 2021
See if this doc page helps: Write Data to Excel Spreadsheets
Mojtaba Mohareri
Mojtaba Mohareri on 5 Jun 2021
Dear Mr. Kraus, I could write the following code thanks to you:
clear all;
N=20; % the number of matrices
m=5; % the dimension of matrices
filename = 'Langari.xlsx';
for n=2:N+1
bounds = [-2,4];
A = rand(m,m) * range(bounds) + bounds(1) % creating a matirx with entries in range of [-15,10]
B(n,2)=nnz(A)/numel(A); %the sparsity rate
B(n,3)=nnz(tril(A))/numel(A); % the lower nozero rate
B(n,4)=nnz(diag(A))/numel(A); % the diagonal nozero rate
B(n,5)=nnz(triu(A))/numel(A); % the upper nozero rate
B(n,6)=norm(A,1); % the one norm
B(n,7)=norm(A,'inf');% the infinity norm
B(n,8)=norm(A,'fro'); % the Frobenius norm
for t=2:11
The only thing remained to me is that I want to change some names of entries like this
How can I do that? I was wondering if you could help me about my problem.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by