nonconformant arguments

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

nonconformant arguments

Hamed Khatibi
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks



Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

BGreen

On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks


"all" does not appear to be a recognized option for the sum function - see here:

If you just want to concatenate strings, you could do so with
o_vector(i,j) = input( strcat( 'Please enter the ', num2str(j), 'th element of the ', num2str(i), 'th region output vector: ')


Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

Doug Stewart-4
In reply to this post by Hamed Khatibi


On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks





you can try this:
o_vector(i,j) = input(['Please enter the '  num2str(j)  'th element of the '  i  'th region output vector: ']);
--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

Hamed Khatibi
In reply to this post by BGreen
Thanks a lot. I solve the input problem and also I have same error in disp function, so I replace "+" with strcat(... , ... , ...) .
But I don't know what to do with Xn = sum(o_vector,'all');
The code has no problem with matlab but has error with octave in this line.

On Sat, Apr 4, 2020 at 9:12 PM Brett Green <[hidden email]> wrote:

On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks


"all" does not appear to be a recognized option for the sum function - see here:

If you just want to concatenate strings, you could do so with
o_vector(i,j) = input( strcat( 'Please enter the ', num2str(j), 'th element of the ', num2str(i), 'th region output vector: ')


Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

BGreen
In reply to this post by BGreen


On Sat, Apr 4, 2020 at 1:24 PM Hamed Khatibi <[hidden email]> wrote:
This is my full code. Thanks for yor help.

On Sat, Apr 4, 2020 at 9:12 PM Brett Green <[hidden email]> wrote:

On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks


"all" does not appear to be a recognized option for the sum function - see here:

If you just want to concatenate strings, you could do so with
o_vector(i,j) = input( strcat( 'Please enter the ', num2str(j), 'th element of the ', num2str(i), 'th region output vector: ')

Please always CC the mailing list.

What do you want to do with Xn and ovector? We cannot help unless we know what you are trying to achieve.




Project2-1.m (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

Hamed Khatibi
I want Xn to be the sum of all elements in o_vector matrix. In Matlab 2018 and newer versions the
Xn = sum(o_vector,'all');
does this work. But octave doesn't support this. How can I do this in octave?

On Sat, Apr 4, 2020 at 10:11 PM Brett Green <[hidden email]> wrote:


On Sat, Apr 4, 2020 at 1:24 PM Hamed Khatibi <[hidden email]> wrote:
This is my full code. Thanks for yor help.

On Sat, Apr 4, 2020 at 9:12 PM Brett Green <[hidden email]> wrote:

On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks


"all" does not appear to be a recognized option for the sum function - see here:

If you just want to concatenate strings, you could do so with
o_vector(i,j) = input( strcat( 'Please enter the ', num2str(j), 'th element of the ', num2str(i), 'th region output vector: ')

Please always CC the mailing list.

What do you want to do with Xn and ovector? We cannot help unless we know what you are trying to achieve.



Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

BGreen
On Sat, Apr 4, 2020 at 2:17 PM Hamed Khatibi <[hidden email]> wrote:
I want Xn to be the sum of all elements in o_vector matrix. In Matlab 2018 and newer versions the
Xn = sum(o_vector,'all');
does this work. But octave doesn't support this. How can I do this in octave?

On Sat, Apr 4, 2020 at 10:11 PM Brett Green <[hidden email]> wrote:


On Sat, Apr 4, 2020 at 1:24 PM Hamed Khatibi <[hidden email]> wrote:
This is my full code. Thanks for yor help.

On Sat, Apr 4, 2020 at 9:12 PM Brett Green <[hidden email]> wrote:

On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks


"all" does not appear to be a recognized option for the sum function - see here:

If you just want to concatenate strings, you could do so with
o_vector(i,j) = input( strcat( 'Please enter the ', num2str(j), 'th element of the ', num2str(i), 'th region output vector: ')

Please always CC the mailing list.

What do you want to do with Xn and ovector? We cannot help unless we know what you are trying to achieve.


You can do that with
Xn = sum(sum(o_vector));
or
Xni = sum(o_vector);
Xn = sum(Xni);


Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

Hamed Khatibi
Thanks a lot.

On Sat, Apr 4, 2020 at 11:17 PM Brett Green <[hidden email]> wrote:
On Sat, Apr 4, 2020 at 2:17 PM Hamed Khatibi <[hidden email]> wrote:
I want Xn to be the sum of all elements in o_vector matrix. In Matlab 2018 and newer versions the
Xn = sum(o_vector,'all');
does this work. But octave doesn't support this. How can I do this in octave?

On Sat, Apr 4, 2020 at 10:11 PM Brett Green <[hidden email]> wrote:


On Sat, Apr 4, 2020 at 1:24 PM Hamed Khatibi <[hidden email]> wrote:
This is my full code. Thanks for yor help.

On Sat, Apr 4, 2020 at 9:12 PM Brett Green <[hidden email]> wrote:

On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks


"all" does not appear to be a recognized option for the sum function - see here:

If you just want to concatenate strings, you could do so with
o_vector(i,j) = input( strcat( 'Please enter the ', num2str(j), 'th element of the ', num2str(i), 'th region output vector: ')

Please always CC the mailing list.

What do you want to do with Xn and ovector? We cannot help unless we know what you are trying to achieve.


You can do that with
Xn = sum(sum(o_vector));
or
Xni = sum(o_vector);
Xn = sum(Xni);


Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

BGreen

- Brett Green


On Sat, Apr 4, 2020 at 2:58 PM Hamed Khatibi <[hidden email]> wrote:
Thanks a lot.

On Sat, Apr 4, 2020 at 11:17 PM Brett Green <[hidden email]> wrote:
On Sat, Apr 4, 2020 at 2:17 PM Hamed Khatibi <[hidden email]> wrote:
I want Xn to be the sum of all elements in o_vector matrix. In Matlab 2018 and newer versions the
Xn = sum(o_vector,'all');
does this work. But octave doesn't support this. How can I do this in octave?

On Sat, Apr 4, 2020 at 10:11 PM Brett Green <[hidden email]> wrote:


On Sat, Apr 4, 2020 at 1:24 PM Hamed Khatibi <[hidden email]> wrote:
This is my full code. Thanks for yor help.

On Sat, Apr 4, 2020 at 9:12 PM Brett Green <[hidden email]> wrote:

On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks


"all" does not appear to be a recognized option for the sum function - see here:

If you just want to concatenate strings, you could do so with
o_vector(i,j) = input( strcat( 'Please enter the ', num2str(j), 'th element of the ', num2str(i), 'th region output vector: ')

Please always CC the mailing list.

What do you want to do with Xn and ovector? We cannot help unless we know what you are trying to achieve.


You can do that with
Xn = sum(sum(o_vector));
or
Xni = sum(o_vector);
Xn = sum(Xni);

You're welcome. "sum" adds all elements over one dimension each time it is called, so to add all elements over 2 dimensions, you can call it twice.


Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

Hamed Khatibi
Awesome, thanks!
Can you please help me with these lines too:
writecell({'R'},'Output.xlsx','sheet',1,'Range','A1');
writematrix(R,'Output.xlsx','sheet',1,'Range','A2');

writecell({'C'},'Output.xlsx','sheet',2,'Range','A1');
writematrix(C,'Output.xlsx','sheet',2,'Range','A2');

writecell({'LQ'},'Output.xlsx','sheet',3,'Range','A1');
writematrix(LQ,'Output.xlsx','sheet',3,'Range','A2');

writecell({'Region/Section per region'},'Output.xlsx','sheet',4,'Range','A1');
writematrix(o_vector,'Output.xlsx','sheet',4,'Range','A2');

writecell and writematrix don't work in octave and only work in matlab. I want replaces for them in octave.
Thanks again.

On Sat, Apr 4, 2020 at 11:34 PM Brett Green <[hidden email]> wrote:

- Brett Green


On Sat, Apr 4, 2020 at 2:58 PM Hamed Khatibi <[hidden email]> wrote:
Thanks a lot.

On Sat, Apr 4, 2020 at 11:17 PM Brett Green <[hidden email]> wrote:
On Sat, Apr 4, 2020 at 2:17 PM Hamed Khatibi <[hidden email]> wrote:
I want Xn to be the sum of all elements in o_vector matrix. In Matlab 2018 and newer versions the
Xn = sum(o_vector,'all');
does this work. But octave doesn't support this. How can I do this in octave?

On Sat, Apr 4, 2020 at 10:11 PM Brett Green <[hidden email]> wrote:


On Sat, Apr 4, 2020 at 1:24 PM Hamed Khatibi <[hidden email]> wrote:
This is my full code. Thanks for yor help.

On Sat, Apr 4, 2020 at 9:12 PM Brett Green <[hidden email]> wrote:

On Sat, Apr 4, 2020 at 12:37 PM Hamed Khatibi <[hidden email]> wrote:
Hi
Please help me with this error:
operator +: nonconformant arguments (op1 is 1x17, op2 is 1x18)
error: called from
    Project2 at line 14 column 23

The part of the code is:
o_vector(i,j) = input('Please enter the '+num2str(j)+...
            'th element of the '+i+'th region output vector: ');

Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.

Please help me how can I correct these types of errors when using octave instead of Matlab.
Thanks


"all" does not appear to be a recognized option for the sum function - see here:

If you just want to concatenate strings, you could do so with
o_vector(i,j) = input( strcat( 'Please enter the ', num2str(j), 'th element of the ', num2str(i), 'th region output vector: ')

Please always CC the mailing list.

What do you want to do with Xn and ovector? We cannot help unless we know what you are trying to achieve.


You can do that with
Xn = sum(sum(o_vector));
or
Xni = sum(o_vector);
Xn = sum(Xni);

You're welcome. "sum" adds all elements over one dimension each time it is called, so to add all elements over 2 dimensions, you can call it twice.


Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

BGreen

On Sat, Apr 4, 2020 at 3:18 PM Hamed Khatibi <[hidden email]> wrote:
Awesome, thanks!
Can you please help me with these lines too:
writecell({'R'},'Output.xlsx','sheet',1,'Range','A1');
writematrix(R,'Output.xlsx','sheet',1,'Range','A2');

writecell({'C'},'Output.xlsx','sheet',2,'Range','A1');
writematrix(C,'Output.xlsx','sheet',2,'Range','A2');

writecell({'LQ'},'Output.xlsx','sheet',3,'Range','A1');
writematrix(LQ,'Output.xlsx','sheet',3,'Range','A2');

writecell({'Region/Section per region'},'Output.xlsx','sheet',4,'Range','A1');
writematrix(o_vector,'Output.xlsx','sheet',4,'Range','A2');

writecell and writematrix don't work in octave and only work in matlab. I want replaces for them in octave.
Thanks again.

You're welcome. Unfortunately, I've never used the Excel functions, so I will leave that for someone else to answer. In the meantime, here is the documentation on xls functions implemented in Octave in the io package - I hope that helps.


Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

nrjank
Administrator
In reply to this post by BGreen
Also if i bypass this error I have another errors, for example in this line:
Xn = sum(o_vector,'all');
The debuger says "all" is undefined.


hmmm... looks like matlab's sum added an "all" option in 2018b that hasn't been implemented in Octave yet.  

vs

it's the equivalent of sum(A(:))  (sum every element and return a single number output)

probably an easy fix, but it's a compiled function so if a patch is made you'll need to compile it or wait for it to be rolled out with a future version of octave.  

for now, you can replace  
>> sum(o_vector,'all')

with
 
>> sum(o_vector(:))

that will work no matter the size or shape of o_vector.

I've created a bug report here: https://savannah.gnu.org/bugs/index.php?58116


Reply | Threaded
Open this post in threaded view
|

Re: nonconformant arguments

nrjank
Administrator
On Sun, Apr 5, 2020, 12:18 AM Hamed Khatibi <[hidden email]> wrote:

I want Xn to be the sum of all elements in o_vector matrix. In Matlab 2018 and newer versions the 
Xn = sum(o_vector,'all');
does this work. But octave doesn't support this. How can I do this in octave?

again, please don't top-post.


for now, you can replace  
>> sum(o_vector,'all')

with
 
>> sum(o_vector(:))

that will work no matter the size or shape of o_vector.