How to concatenate 2 arrays vertically in a .mat file ?
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commento
  Walter Roberson
      
      
 il 22 Dic 2017
				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.
Risposte (0)
Vedere anche
Categorie
				Scopri di più su Whos in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

