How to concatenate 2 arrays vertically in a .mat file ?

4 ビュー (過去 30 日間)
PRIYANKA MATHIKSHARA M 16BLC1047
PRIYANKA MATHIKSHARA M 16BLC1047 2017 年 12 月 22 日
コメント済み: Walter Roberson 2017 年 12 月 22 日
Hey im trying to append the variable F with the file db.mat
%%Taking an Image
clc
close all
[fname path]=uigetfile('.jpg','Open a face as input for Training');
fname = strcat(path,fname);
im = imread('fname');
imshow(im);
title('Input Face');
c = input('Enter the input class: ');
%%Feature Extraction
F = featureStatistical(im);
load 'db.mat' x
F=[F c]; % F would have mean and standard deviation
x = [x F]
save db.mat x
where F is returned from this function:
function [F] = featureStatistical(im); % function featureStatistical returns F and gets im as its argument
im = double(im);
m = mean(mean(im));
s = std(std(im));
F = [m s];
On trying to do so, I'm getting the following error:
Error using horzcat
The following error occurred converting from double to struct:
Conversion to struct from double is not possible.
Error in module1_Training (line 14)
x = [x F]
say my file db.mat has:
23.6 4.95 1.0
56.2 3.25 2.0
and that my F is:
56.3 5.36 3.0
I would wish to have my db.mat to be:
23.6 4.95 1.0
56.2 3.25 2.0
56.3 5.36 3.0
Thanks in advance :)
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 12 月 22 日
say my file db.mat has:
23.6 4.95 1.0
56.2 3.25 2.0
But it doesn't. .mat files store variables, and the variable x that is currently in the file is a struct rather than a double array.

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

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by