필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to expand matrice with zeroes?

조회 수: 1 (최근 30일)
andrew_cup
andrew_cup 2012년 11월 22일
마감: MATLAB Answer Bot 2021년 8월 20일
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?

답변 (1개)

Image Analyst
Image Analyst 2012년 11월 22일
Read it in with xlsread(). Insert the columns and rows. Then write back out with xlswrite().
  댓글 수: 2
andrew_cup
andrew_cup 2012년 11월 22일
편집: andrew_cup 2012년 11월 22일
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 2012년 11월 22일
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.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by