フィルターのクリア

Save plot values as table values and output them to the table

25 ビュー (過去 30 日間)
지현
지현 2023 年 1 月 31 日
回答済み: Swaraj 2023 年 2 月 8 日
The plotted values must be output to the table.
It's a 10*10 table and the plot is an image plot with 0-100%
  2 件のコメント
Dr. JANAK TRIVEDI
Dr. JANAK TRIVEDI 2023 年 1 月 31 日
% Define the size of the table
rows =
10;
cols =
10;
% Generate the data for the image plot
data =
rand(rows, cols) * 100;
% Plot the data as an image
imagesc(data);
colormap('gray');
axis equal tight;
% Convert the data to
a table
T =
array2table(data);
T
.Properties.RowNames = strtrim(cellstr(num2str((1:rows)')));
T
.Properties.VariableNames = strtrim(cellstr(num2str((1:cols)')));
%
Display the table
disp(T);

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

回答 (1 件)

Swaraj
Swaraj 2023 年 2 月 8 日
A matrix can be created representing the image. We can than visualize the image.
Array2table can be used to get a table out of the image matrix.
% Creating a Random Image for the sake of example
data = rand(10);
% Plotting the randomly generated Image
imagesc(data);
% Using array2table to get table from the image
table = array2table(data, 'VariableNames', cellstr(num2str((1:10)', 'col_%d')));
% Display the table to check output
disp(table);
% To export the table to the .txt file with name table.txt
writetable(table);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by