help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: write empty in excel


From: Brett Green
Subject: Re: write empty in excel
Date: Sat, 13 Jul 2019 10:23:13 -0400

It takes a little modification just to make everything strings, but using that general idea works:

for k=1:6
v{k} = num2str(k);
end
v{4} = "";

fid = fopen ("example.csv", "w");
for k=1:6
fprintf(fid,strcat(v{k},"\n"))
end
fclose (fid);

- Brett Green


On Sat, Jul 13, 2019 at 9:26 AM Doug Stewart <address@hidden> wrote:


On Sat, Jul 13, 2019 at 8:40 AM Brett Green <address@hidden> wrote:
If I try the following:

for k=1:6
v{k} = k;
end
v{4} = [];

Then I get:

v =
{
  [1,1] =  1
  [1,2] =  2
  [1,3] =  3
  [1,4] = [](0x0)
did you send this to the spreadsheet?
 
  [1,5] =  5
  [1,6] =  6
}

Using curly braces creates cell arrays, which have flexibility to use different sizes and different types of data. You can do this too:

v(4) = "Hello"
v =
{
  [1,1] =  1
  [1,2] =  2
  [1,3] =  3
  [1,4] = Hello
  [1,5] =  5
  [1,6] =  6
}

I'm not sure if there's a better way to print it to a spreadsheet since I've never done that before, but I think you could do it with fprintf.

- Brett Green


On Sat, Jul 13, 2019 at 8:30 AM gigiolone123 via Help-octave <address@hidden> wrote:
hi Doug

it's not possible...it give error

>> v(1)=1
v =  1
>> v(2)=2
v =

   1   2

>> v(3)=3
v =

   1   2   3

>> v(4)="  "
error: =: nonconformant arguments (op1 is 1x1, op2 is 1x2)



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html





--
DASCertificate for 206392


reply via email to

[Prev in Thread] Current Thread [Next in Thread]