write empty in excel

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

write empty in excel

Octave - General mailing list
hi,
i've a variable and i want to write element in excel

v(1)=1
v(2)=2
v(3)=3
v(4)="  "
v(5)=5
v(6)=6

in v(4) i want to write cell "empty" on excel

how value i must to give it? thank




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


Reply | Threaded
Open this post in threaded view
|

Re: write empty in excel

Octave - General mailing list
Reply | Threaded
Open this post in threaded view
|

Re: write empty in excel

Doug Stewart-4
In reply to this post by Octave - General mailing list


On Fri, Jul 12, 2019 at 1:27 PM gigiolone123 via Help-octave <[hidden email]> wrote:
hi,
i've a variable and i want to write element in excel

v(1)=1
v(2)=2
v(3)=3
v(4)="  "

I am not the expert, but you could try
v(4)=[]
 
v(5)=5
v(6)=6

in v(4) i want to write cell "empty" on excel

how value i must to give it? thank




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




--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: write empty in excel

Octave - General mailing list
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


Reply | Threaded
Open this post in threaded view
|

Re: write empty in excel

BGreen
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)
  [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 <[hidden email]> 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




Reply | Threaded
Open this post in threaded view
|

Re: write empty in excel

Doug Stewart-4


On Sat, Jul 13, 2019 at 8:40 AM Brett Green <[hidden email]> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: write empty in excel

BGreen
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 <[hidden email]> wrote:


On Sat, Jul 13, 2019 at 8:40 AM Brett Green <[hidden email]> 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 <[hidden email]> 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