フィルターのクリア

Error while calling reshape

2 ビュー (過去 30 日間)
Balaji M. Sontakke
Balaji M. Sontakke 2018 年 4 月 17 日
コメント済み: Balaji M. Sontakke 2018 年 4 月 18 日
Following is a cell array having size 1 X 180, is it possible to reshape this cell array size into 6*4, here 6 is column in one cell and 4 is sample of one image.
[36,50,3,0.578870350796391,0,1],[71,41,1,4.92191919817520,0,1]..........[38,74,3,3.21149279029833,0,1]
  3 件のコメント
Guillaume
Guillaume 2018 年 4 月 17 日
Any reshaping must preserve the number of elements in the array. Therefore it is never possible to reshape a 1x180 anything into a 6x4 of the same thing, since one has 180 elements while the other has only 24.
However, it sounds like you want something more complicated, possibly reshaping the matrices inside the cell array, but you've not explained that very clearly. Note that the size of a cell array and the size of whatever is inside the cell are two completely different things. You haven't told us what is inside each cell.
Balaji M. Sontakke
Balaji M. Sontakke 2018 年 4 月 18 日
Sir, I have 20 classes 9 images for P_train class and 3 images for P_test classe. four minutie with 6 columns having x,y,Crossing Number,theta(orientation,flag and permissible minutie extracted from each image so I get P_train i.e 720 X 6 and my train label is 180 X 1, I need to make P_train size 180 X 24 because am using knnclassify(P_test, P_train,train_label,1,'euclidean','nearest'); for classification. here one cell contains minutie of one image i.e. [36,50,3,0.578870350796391,0,1] sir, my problem is that my train_label size is 180 X 1 so i need my P_train also 180 X 24 here 24 is (6*4) 6 and 4 means, four minutie with 6 columns having x,y,Crossing Number,theta(orientation,flag and permissible minutie.
clear all; clc;
%% load mat files load('db1.mat'); load('db2.mat');
%% reshape into row vector
reduced_testdata = reshape(reduced_testdata,1,4,15); reduced_traindata = reshape(reduced_traindata,1,4,45);
% Convert cell array to matrix
P_test = cell2mat(reduced_testdata); P_train = cell2mat(reduced_traindata);
%% labeling class train_label=load('train_label.txt'); test_label=load('test_label.txt');
%% Normalisation
P_train=mapminmax(P_train,0,1);
P_test=mapminmax(P_test,0,1);
%% classfication
predictlabel = knnclassify(P_test, P_train, train_label,1,'euclidean','nearest'); cp = classperf(test_label,predictlabel); cp.CorrectRate*100

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by