Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How to expand matrice with zeroes?

1 Ansicht (letzte 30 Tage)
andrew_cup
andrew_cup am 22 Nov. 2012
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
I have a xls file with 3 columns and 212 rows of data. Is there any way to insert 3 columns of zeroes with x number of rows in the middle, so there is a total of 365 rows?

Antworten (1)

Image Analyst
Image Analyst am 22 Nov. 2012
Read it in with xlsread(). Insert the columns and rows. Then write back out with xlswrite().
  2 Kommentare
andrew_cup
andrew_cup am 22 Nov. 2012
Bearbeitet: andrew_cup am 22 Nov. 2012
like this?
filename = 'testdata.xls';
A = zeros(153,3);
sheet = 1;
x1Range = 'A122';
xlswrite(filename,A,sheet,x1Range);
snodybde = xlsread('testdata.xls');
Image Analyst
Image Analyst am 22 Nov. 2012
No. All you attempted was writing the stuff back out. Where is your call to xlsread, and your insertion code??????
[numbers txt raw] = xlsread('testdata.xls');
insertionRow = 10;
output = [numbers(1:insertionRow, :); newXRows; numbers((insertionRow+1):end,:)];
xlswrite(output, 'testdata.xls', 'D1'); % Write into columns 4-6.
or something like that.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by