Append a row to a workspace table
Afficher commentaires plus anciens
I imported a table made in excel into MATLAB and it is now a table in my workspace. The Name is "Configuration" and it is a 1 x 20 table in my workspace. If you open up "Configuration" it looks like this:
>>
1 2 3 4 5 6 7
BookID State noofVols Vol_Interval VOL1 Vol2 Vol3
______ _______ ________ ____________ _______ _______ _______
NaN NaN NaN NaN NaN NaN NaN
>> disp(Configuration)
T2 = Configuration
W=width(T2)
BookID = 2;
State = ‘Open’;
noofVols = 2;
Vol_Interval = 4;
VOL1 = ‘BX2’;
Vol2 = “not used’;
Vol3 = ‘not used’;
appendRowVars = {BookID, State, noofVols, Vol_Interval, VOL1, Vol2, Vol3}
T2(end+1) = appendRowVars;
I am using MATLAB version 9.5.0.944444 (R2018b),. When I run this I get T2 = 1 x 7, W = 7, then I get an error message "Conversion to double frm cell is not possible"
Help
1 commentaire
Jo Bremer Balestracci
le 29 Sep 2020
Modifié(e) : Jo Bremer Balestracci
le 29 Sep 2020
Réponse acceptée
Plus de réponses (1)
Stijn Haenen
le 29 Sep 2020
If you have two tables for example:
a=table();
a.Var1(1,1) = 1;
a.Var2(1,1) = 1;
a.Var1(2,1) = 3;
a.Var2(2,1) = 3;
b=table();
b.Var1(1,1) = 2;
b.Var2(1,1) = 2;
you can insert table b into table a with:
c=[a(1,:); b(1,:) ;a(2,:)];
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!