how can we create image through dataset consisting of 702 rows and 1 column?

1 view (last 30 days)
SHRUTI AWASTHI
SHRUTI AWASTHI on 26 Apr 2022
Commented: Shruti Awasthi on 22 May 2022
I want to create image from the dataset consisting of 702 rows and 1 column. Can you help me with the matlab code for creating the image?
thanks
  5 Comments

Sign in to comment.

Answers (3)

Walter Roberson
Walter Roberson on 26 Apr 2022
I = reshape(Data, 26, 27);
imshow(I, [])
  2 Comments
Walter Roberson
Walter Roberson on 27 Apr 2022
702 pixels can be factored into rectangles in multiple ways. The 26*27 or 27*26 seems most likely, unless the pixels are rgb or unless the image is known to have a 2:3 or 3:2 aspect ratio.

Sign in to comment.


Image Analyst
Image Analyst on 22 May 2022
Attach one of the CSV files. Basically you just read in the CSV file and it's automatically an spectrogram image that can be displayed.
grayImage = readmatrix(csvFileName);
[rows, columns] = size(grayImage)
imshow(grayImage, []);
ylabel('Row', 'FontSize', 18);
xlabel('Frequency', 'FontSize', 18)
  6 Comments

Sign in to comment.


Image Analyst
Image Analyst on 22 May 2022
Try this:
filename = 'x_19_loc(without).csv';
data = readmatrix(filename);
freq = data(:, 1);
[rows, columns] = size(data)
XData = [1, columns];
YData = [min(freq), max(freq)]
imagesc(mat2gray(data(:, 2:end)));
colormap(gray(256))
% imshow(data(:, 2:end), [], 'XData', XData, 'YData', YData, 'InitialMagnification', 2000000);
grid on;
xlabel('Location')
ylabel('Frequency')
axis('on')
xticks(1:columns)
  3 Comments

Sign in to comment.

Categories

Tags

Community Treasure Hunt

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

Start Hunting!