How to save obtained information from matlab in Excel

1 Ansicht (letzte 30 Tage)
Hello.
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.

Akzeptierte Antwort

Benjamin Kraus
Benjamin Kraus am 4 Jun. 2021
See if this doc page helps: Write Data to Excel Spreadsheets
  8 Kommentare
Mojtaba Mohareri
Mojtaba Mohareri am 5 Jun. 2021
All right. Understood completely. Thank you so much for devoting your time to answering my questions and helping me to increase my knowledge on this matter.
Mojtaba Mohareri
Mojtaba Mohareri am 5 Jun. 2021
Dear Mr. Kraus, I could write the following code thanks to you:
clear all;
clc;
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
B(n,9)=min(sum(A,1));
B(n,10)=min(sum(A,2));
B(n,11)=mean(nonzeros(A));
B(n,12)=cond(A);
end
for t=2:11
B(1,t)=t;
end
xlswrite(filename,B)
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by