how we find trainSet or testSet in form of row or column????

2 views (last 30 days)
http://www.mathworks.com/matlabcentral/answers/246685-how-we-find-a-particular-number-from-the-matrix-in-matlab#comment_313777. in this link you told about the trainset or testset..bt i want to show in a row or column wise trainset/testset...how can we show????

Answers (1)

Aditya
Aditya on 22 Jul 2025
Hi Prema,
If you want to display your training or test set in MATLAB either row-wise or column-wise, you can use simple indexing with the disp function. For example, to view specific rows of your training set, you can select those rows and display them using xtrain(rows, :), where rows is the range of row indices you want to see. Similarly, to look at specific columns, use xtrain(:, columns), where columns is the range of column indices. This approach allows you to easily inspect the data in your training or test sets, either by rows (to see individual samples) or by columns (to check specific features). If you also want to see the labels alongside the features, you can concatenate the label vector to your selected rows or columns for a combined display.
Here are some code snippets to illustrate these approaches:
% Display the first 5 rows (samples) of the training set
disp('First 5 rows of xtrain:');
disp(xtrain(1:5, :));
% Display the first 3 columns (features) of the training set
disp('First 3 columns of xtrain:');
disp(xtrain(:, 1:3));
% Display the first 5 training samples along with their labels
disp('First 5 samples (features and label):');
disp([xtrain(1:5, :) ytrain(1:5)]);

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!