how can i Insert row in between the existing data in an excel sheet without overwriting the below data.
26 views (last 30 days)
Show older comments
vickey vardwaj on 19 Aug 2021
Commented: Walter Roberson on 19 Aug 2021
xlRange4 = ['B',num2str(nextRow2)];
xlRange5 = ['E',num2str(nextRow2)];
i am using this code but there the below data is getting overwrittened.
You will need to use activexserver() to connect to Excel, and use the DCOM interface to execute Insert commands
There is no facility inside MATLAB itself for inserting or deleting rows or columns in spreadsheets (without rewriting the rest of the spreadsheet)
If you are talking about MATLAB cell arrays, then the answer is more No than Yes.
MATLAB cell arrays are arrays of pointers to descriptions of data ,with the description most often including a pointer to the storage for the values.
When you assign to an element of a cell array, the pointer to the description of the entry is overwritten with a pointer to the description of the new value. The memory itself is not copied, just the pointer.
In order to insert a new row in a cell array, matlab has to first create a new larger cell array. It then copies the pointers to descriptions from the old cell to the new cell, in the appropriate places. The data enclosed is not moved, just the pointers. But the process does have to create the new cell array (and after dispose of the old list of pointers).
At the moment I cannot think of anything in MATLAB that is known to be implemented as a linked list (there might be internal ones not visible to users)
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!