HOw do i copy a particular 4x4 cell aray into a 5x5 cell array?

1 vue (au cours des 30 derniers jours)
sachin narain
sachin narain le 13 Juin 2018
I have a 5x5 cell array 'raw_Grounds'.I have another cell array with size 4x4 with some datas in it. If you notice the data picture attached , it contains the same data like the raw grounds from 2,2 cell to the end(with an edited values)
What i need to do is,copy the datas line by line from cell array 'data' to Raw Grounds. THe 1st column of raw_grounds remains unchanged .Only the dats get copy pasted from the 2nd column. ALso to note is,while copying line by line on to the raw_Grounds,the code must skip empty rows.
Raw Grounds contains 1st row with NaN values(shown in the picture attached)
Kindly help me with this.Hpoe the Question is clear.Seeing the pictures attached will make it more clear

Réponses (1)

Gayatri Menon
Gayatri Menon le 26 Juin 2018
Hi,
Hope this example script helps you. Here I have created 2 cell arrays, excel and data. The first line of excel cell array contains 'NaN' values. I can replace the rest of the lines with the values from data cell array using the following code snippet:
% creating two sample cell arrays
excel={'test1',NaN,NaN;'test2','a',1;'test3','b',2}
data={'a_new',1.5; 'b_new' 2.5;}
% replacing the values of excel excluding 1st coloumn and and 1st row
excel(2:3,2:3)=data
Regards,
Gayatri

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by