필터 지우기
필터 지우기

Write a file starting in column 7.

조회 수: 2 (최근 30일)
Leonardo Barbosa Torres dos Santos
Dear, I have a question about write the data in the file.
Is possible write a data in the file starting in column 7 ?
For example:
My program is writing:
Line 1 and Column 1 until 36
Line 2 and Column 1 until 36
.
.
Line 19 and colund 1 until 36.
I would like write starting in column 7 until 42.
that is:
line 1 and Column 7 until 42
line 2 and Column 7 until 42
.
.
line 19 and Column 7 until 42.
That is, all line of column 1 until column 6 stay empty.
Is it possible ?
thank you
  댓글 수: 1
dpb
dpb 2019년 4월 5일
Certainly possible but specifics depend on what kind of file you're trying to create???

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

채택된 답변

A. Sawas
A. Sawas 2019년 4월 5일
If your data is in csv format, you can use the command csvwrite with row and col parameters as follows:
row = 0;
col = 6; % row and cols are zero-based so row=0 and col=0 are the first row and column, respectively.
csvwrite(filename, yourdata, row, col);
  댓글 수: 2
Leonardo Barbosa Torres dos Santos
Thank you for answer.
I would like write the file in .mat
I am saving the file this form: save('test_Cj3p09_30082020_4points', 'C', '-append')
The variable that I want to save is C, where C is the 19x36 double.
Starting in columns 1 until 36.
But I need save this variable starting in column 7 until 42.
Thanks in advance
A. Sawas
A. Sawas 2019년 4월 5일
Try appending zeros to C in the columns from 1 to 6, like this:
C = [zeros(19,6) C];

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

추가 답변 (1개)

Leonardo Barbosa Torres dos Santos
Thank you very much,
Is working now

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by