arrange the values in an array

I have an array A(80 rows and 5 columns). I want to export it as a table to microsoft word as the values in A (i:i+4,j)are placed in one cell with no cell line between them. Not sure if it's possible in Matlab.

댓글 수: 3

Andrei Bobrov
Andrei Bobrov 2011년 4월 29일
Hi Hassan, in this case i = 1: size (A,1) -4, is not it?
Hassan
Hassan 2011년 4월 29일
Hi Andrei, I didn't get what you said but
for i=1:5:80
for j=1:5
A(i:i+4,j)
% export it to word and remove the cell line for the above subarray which I dont know how? well, I don't think it's possible in Matlab. Maybe I need to copy A into an Excel's shet and then copy it from Excel to Word, select 5 cells (rows 1:5, column 1) and use Merge Cell option.
% know how
Andrei Bobrov
Andrei Bobrov 2011년 4월 29일
agree or Excel or textfile.txt

댓글을 달려면 로그인하십시오.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 4월 29일

0 개 추천

in Excel
xlswrite('namexls',cellfun(@(x)num2str(x.'), mat2cell(A,5*ones(size(A,1)/5,1),ones(1,size(A,2))),'UniformOutput' , false),1,'A1');

댓글 수: 1

Hassan
Hassan 2011년 4월 29일
thanks a lot Andrei, this is the thing I was looking for. however, the values in each cell are arranged horizontally while I want to arrange them vertically. I sthere any way to transpose the data in each cell?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Friedrich
Friedrich 2011년 4월 29일

1 개 추천

Or you can use Word as Com Server. I prepared a little example for you:
e = actxserver('Word.Application')
e.visible = 1
doc = e.newDocument.Application.Documents.Add
doc.Content.InsertAfter('text')

댓글 수: 1

Hassan
Hassan 2011년 4월 29일
thanks Friedrich. It's a good example to see how can have access to Word from Matlab.

댓글을 달려면 로그인하십시오.

카테고리

태그

질문:

2011년 4월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by