How to save obtained information from matlab in Excel

1 回表示 (過去 30 日間)
Mojtaba Mohareri
Mojtaba Mohareri 2021 年 6 月 4 日
コメント済み: Mojtaba Mohareri 2021 年 6 月 5 日
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.

採用された回答

Benjamin Kraus
Benjamin Kraus 2021 年 6 月 4 日
See if this doc page helps: Write Data to Excel Spreadsheets
  8 件のコメント
Mojtaba Mohareri
Mojtaba Mohareri 2021 年 6 月 5 日
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 2021 年 6 月 5 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by