HOw do i copy a particular 4x4 cell aray into a 5x5 cell array?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Gayatri Menon
2018-6-26
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!