Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to get multiprod working

Subject: how to get multiprod working

From: Jonathan W Smith

Date: 21 Jan, 2011 00:46:04

Message: 1 of 17

Hello
I downloaded multiprod. What is next? Do you have to "install" it? What MATLAB directory does it go under. How can I use it like any other function (i.e. find, flipud,etc...)

Thanks
Jonathan

Subject: how to get multiprod working

From: James Tursa

Date: 21 Jan, 2011 01:03:04

Message: 2 of 17

"Jonathan W Smith" wrote in message <ihal0c$l8n$1@fred.mathworks.com>...
> Hello
> I downloaded multiprod. What is next? Do you have to "install" it? What MATLAB directory does it go under. How can I use it like any other function (i.e. find, flipud,etc...)
>
> Thanks
> Jonathan

I think you just put the m-files anywhere on the MATLAB path, usually in one of your own directories (not a MATLAB toolbox directory). You might also have a look at this submission:

http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multiply-with-multi-dimensional-support


James Tursa

Subject: how to get multiprod working

From: Jonathan W Smith

Date: 21 Jan, 2011 11:14:05

Message: 3 of 17

"James Tursa" wrote in message <iham08$pjm$1@fred.mathworks.com>...
> "Jonathan W Smith" wrote in message <ihal0c$l8n$1@fred.mathworks.com>...
> > Hello
> > I downloaded multiprod. What is next? Do you have to "install" it? What MATLAB directory does it go under. How can I use it like any other function (i.e. find, flipud,etc...)
> >
> > Thanks
> > Jonathan
>
> I think you just put the m-files anywhere on the MATLAB path, usually in one of your own directories (not a MATLAB toolbox directory). You might also have a look at this submission:
>
> http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multiply-with-multi-dimensional-support
>
>
> James Tursa

James and all
multiprod and mtimesx are not running even when I dragged the utility into the MATLAB folder. I am running MATLAB on Windows XP. I have the 2006 version. Does you or do you know anyone that has some explicit directions on how to install multiprod or mtimesx? I did not see a readme.

Thanks

Subject: how to get multiprod working

From: Bruno Luong

Date: 21 Jan, 2011 11:25:21

Message: 4 of 17

Compile the MEX by invoking
> mtimesx_build

Bruno

Subject: how to get multiprod working

From: Jonathan W Smith

Date: 21 Jan, 2011 13:56:04

Message: 5 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ihbqf1$6c6$1@fred.mathworks.com>...
> Compile the MEX by invoking
> > mtimesx_build
>
> Bruno

In a MATLAB session?

I got this error in the MATLAB session: ??? Undefined function or variable 'mtimesx_build'.

Thanks
Jonathan

Subject: how to get multiprod working

From: Steven_Lord

Date: 21 Jan, 2011 14:38:44

Message: 6 of 17



"Jonathan W Smith" <jwsmith9@gmail.com> wrote in message
news:ihbppt$nl1$1@fred.mathworks.com...
> "James Tursa" wrote in message <iham08$pjm$1@fred.mathworks.com>...
>> "Jonathan W Smith" wrote in message <ihal0c$l8n$1@fred.mathworks.com>...
>> > Hello
>> > I downloaded multiprod. What is next? Do you have to "install" it?
>> > What MATLAB directory does it go under. How can I use it like any
>> > other function (i.e. find, flipud,etc...)
>> >
>> > Thanks
>> > Jonathan
>>
>> I think you just put the m-files anywhere on the MATLAB path, usually in
>> one of your own directories (not a MATLAB toolbox directory). You might
>> also have a look at this submission:
>>
>> http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multiply-with-multi-dimensional-support
>>
>>
>> James Tursa
>
> James and all
> multiprod and mtimesx are not running even when I dragged the utility into
> the MATLAB folder. I am running MATLAB on Windows XP. I have the 2006
> version. Does you or do you know anyone that has some explicit directions
> on how to install multiprod or mtimesx? I did not see a readme.

Do NOT add, remove, or modify files under the toolbox subdirectory of the
MATLAB root directory (as returned by the MATLABROOT function.)

http://www.mathworks.com/help/techdoc/matlab_env/f8-28521.html

Place these files in another directory that is on the search path.

http://www.mathworks.com/help/techdoc/matlab_env/br7ppws-1.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: how to get multiprod working

From: Jonathan W Smith

Date: 22 Jan, 2011 01:57:04

Message: 7 of 17

"Steven_Lord" <slord@mathworks.com> wrote in message <ihc5pk$o8u$1@fred.mathworks.com>...
>
>
> "Jonathan W Smith" <jwsmith9@gmail.com> wrote in message
> news:ihbppt$nl1$1@fred.mathworks.com...
> > "James Tursa" wrote in message <iham08$pjm$1@fred.mathworks.com>...
> >> "Jonathan W Smith" wrote in message <ihal0c$l8n$1@fred.mathworks.com>...
> >> > Hello
> >> > I downloaded multiprod. What is next? Do you have to "install" it?
> >> > What MATLAB directory does it go under. How can I use it like any
> >> > other function (i.e. find, flipud,etc...)
> >> >
> >> > Thanks
> >> > Jonathan
> >>
> >> I think you just put the m-files anywhere on the MATLAB path, usually in
> >> one of your own directories (not a MATLAB toolbox directory). You might
> >> also have a look at this submission:
> >>
> >> http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multiply-with-multi-dimensional-support
> >>
> >>
> >> James Tursa
> >
> > James and all
> > multiprod and mtimesx are not running even when I dragged the utility into
> > the MATLAB folder. I am running MATLAB on Windows XP. I have the 2006
> > version. Does you or do you know anyone that has some explicit directions
> > on how to install multiprod or mtimesx? I did not see a readme.
>
> Do NOT add, remove, or modify files under the toolbox subdirectory of the
> MATLAB root directory (as returned by the MATLABROOT function.)
>
> http://www.mathworks.com/help/techdoc/matlab_env/f8-28521.html
>
> Place these files in another directory that is on the search path.
>
> http://www.mathworks.com/help/techdoc/matlab_env/br7ppws-1.html
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com


Hello

I have 2 matrices A(6,6,4,24,28) and B(6,6,28) I want to do the following A(6,6,1,1,1) x B(6,6,1) ... A(6,6,4,24,28) x B(6,6,28) but only when the 5th dimension of A and 3rd dimension of B match.

Perhaps I need a loop.

I was getting erroneous values for the elements in the 6x6 matrices when using multiprod.

I do not have visual basic that allows me to use mtimesx.

Any thoughts?

Thanks
Jonathan

Subject: how to get multiprod working

From: James Tursa

Date: 22 Jan, 2011 04:47:05

Message: 8 of 17

"Jonathan W Smith" wrote in message <ihddhg$hhd$1@fred.mathworks.com>...
>
> I have 2 matrices A(6,6,4,24,28) and B(6,6,28) I want to do the following A(6,6,1,1,1) x B(6,6,1) ... A(6,6,4,24,28) x B(6,6,28) but only when the 5th dimension of A and 3rd dimension of B match.

C = mtimesx(A,reshape(B,6,6,1,1,28));

> I was getting erroneous values for the elements in the 6x6 matrices when using multiprod.

I am not familiar enough with multiprod to know the proper input dimensions needed to do the calculation you want in multiprod. Maybe the following will work:

C = multiprod(A,reshape(B,6,6,1,1,28));

> I do not have visual basic that allows me to use mtimesx.

MTIMESX does not need Visual Basic, or anything from Visual Studio. It can be used by anyone with any C compiler that compiles mex routines, and that includes the lcc compiler that comes shipped with MATLAB. You can build MTIMESX on a Windows system as follows:

- Download from the FEX (I assume you have already done this)
- Copy the files to one of your directories that is on the MATLAB path (see Steve Lord's post).
- Issue the following commands:

mex -setup
(Wait for the prompt, then press Enter)
(Select a C/C++ compiler, such as lcc)
mtimesx % This will cause mtimesx to self-build

If you have a Mac or other Unix/Linux type system, the build routine is not automated. If that is the case let me know and I can try to help with this.

James Tursa

Subject: how to get multiprod working

From: Jonathan W Smith

Date: 22 Jan, 2011 15:19:03

Message: 9 of 17

"James Tursa" wrote in message <ihdng9$jbp$1@fred.mathworks.com>...
> "Jonathan W Smith" wrote in message <ihddhg$hhd$1@fred.mathworks.com>...
> >
> > I have 2 matrices A(6,6,4,24,28) and B(6,6,28) I want to do the following A(6,6,1,1,1) x B(6,6,1) ... A(6,6,4,24,28) x B(6,6,28) but only when the 5th dimension of A and 3rd dimension of B match.
>
> C = mtimesx(A,reshape(B,6,6,1,1,28));
>
> > I was getting erroneous values for the elements in the 6x6 matrices when using multiprod.
>
> I am not familiar enough with multiprod to know the proper input dimensions needed to do the calculation you want in multiprod. Maybe the following will work:
>
> C = multiprod(A,reshape(B,6,6,1,1,28));
>
> > I do not have visual basic that allows me to use mtimesx.
>
> MTIMESX does not need Visual Basic, or anything from Visual Studio. It can be used by anyone with any C compiler that compiles mex routines, and that includes the lcc compiler that comes shipped with MATLAB. You can build MTIMESX on a Windows system as follows:
>
> - Download from the FEX (I assume you have already done this)
> - Copy the files to one of your directories that is on the MATLAB path (see Steve Lord's post).
> - Issue the following commands:
>
> mex -setup
> (Wait for the prompt, then press Enter)
> (Select a C/C++ compiler, such as lcc)
> mtimesx % This will cause mtimesx to self-build
>
> If you have a Mac or other Unix/Linux type system, the build routine is not automated. If that is the case let me know and I can try to help with this.
>
> James Tursa



James and all,

I got MEX to compile and mtimesx to work. I tried the mtimesx suggestion above but it the elements of the 6x6 matrices continued to have the erroneous values. Elements of the 6 x 6 matrices where the values should have been 0 were not.

Matrix B is a column with 28 levels of 6 x 6 matrices. I each level in B contains fractions. I want to multiply these columns in B by A which for every hour (24) of everyday (4 days) has columns of 28 6 x 6 matrices.

The elements of 6 x 6 matrices in A have unique values for every hour of everyday, however the 28 levels are the same. When I multiply each of level in A by their corresponding level in B each hour and level in A, the values in A are adjusted based on the based on the fraction.

Thanks
Jonathan

Jonathan

Subject: how to get multiprod working

From: James Tursa

Date: 23 Jan, 2011 00:22:03

Message: 10 of 17

"Jonathan W Smith" wrote in message <ihesh7$l8f$1@fred.mathworks.com>...
> "James Tursa" wrote in message <ihdng9$jbp$1@fred.mathworks.com>...
> > "Jonathan W Smith" wrote in message <ihddhg$hhd$1@fred.mathworks.com>...
> > >
> > > I have 2 matrices A(6,6,4,24,28) and B(6,6,28) I want to do the following A(6,6,1,1,1) x B(6,6,1) ... A(6,6,4,24,28) x B(6,6,28) but only when the 5th dimension of A and 3rd dimension of B match.
> >
> > C = mtimesx(A,reshape(B,6,6,1,1,28));
> >
> > > I was getting erroneous values for the elements in the 6x6 matrices when using multiprod.
> >
> > I am not familiar enough with multiprod to know the proper input dimensions needed to do the calculation you want in multiprod. Maybe the following will work:
> >
> > C = multiprod(A,reshape(B,6,6,1,1,28));
> >
> > > I do not have visual basic that allows me to use mtimesx.
> >
> > MTIMESX does not need Visual Basic, or anything from Visual Studio. It can be used by anyone with any C compiler that compiles mex routines, and that includes the lcc compiler that comes shipped with MATLAB. You can build MTIMESX on a Windows system as follows:
> >
> > - Download from the FEX (I assume you have already done this)
> > - Copy the files to one of your directories that is on the MATLAB path (see Steve Lord's post).
> > - Issue the following commands:
> >
> > mex -setup
> > (Wait for the prompt, then press Enter)
> > (Select a C/C++ compiler, such as lcc)
> > mtimesx % This will cause mtimesx to self-build
> >
> > If you have a Mac or other Unix/Linux type system, the build routine is not automated. If that is the case let me know and I can try to help with this.
> >
> > James Tursa
>
>
>
> James and all,
>
> I got MEX to compile and mtimesx to work. I tried the mtimesx suggestion above but it the elements of the 6x6 matrices continued to have the erroneous values. Elements of the 6 x 6 matrices where the values should have been 0 were not.
>
> Matrix B is a column with 28 levels of 6 x 6 matrices. I each level in B contains fractions. I want to multiply these columns in B by A which for every hour (24) of everyday (4 days) has columns of 28 6 x 6 matrices.
>
> The elements of 6 x 6 matrices in A have unique values for every hour of everyday, however the 28 levels are the same. When I multiply each of level in A by their corresponding level in B each hour and level in A, the values in A are adjusted based on the based on the fraction.

I am unaware of any bugs in mtimesx. In particular, a 6x6 matrix multiply result is obtained by a call to a BLAS library function, the same library that MATLAB itself uses. So I suspect that your problem is not really a matrix multiply problem. Can you post one of your 6x6 matrix example slices from A and B and show what result you would like to obtain?

James Tursa

Subject: how to get multiprod working

From: Jonathan W Smith

Date: 31 Jan, 2011 12:00:06

Message: 11 of 17

"James Tursa" wrote in message <ihfsbb$i9u$1@fred.mathworks.com>...
> "Jonathan W Smith" wrote in message <ihesh7$l8f$1@fred.mathworks.com>...
> > "James Tursa" wrote in message <ihdng9$jbp$1@fred.mathworks.com>...
> > > "Jonathan W Smith" wrote in message <ihddhg$hhd$1@fred.mathworks.com>...
> > > >
> > > > I have 2 matrices A(6,6,4,24,28) and B(6,6,28) I want to do the following A(6,6,1,1,1) x B(6,6,1) ... A(6,6,4,24,28) x B(6,6,28) but only when the 5th dimension of A and 3rd dimension of B match.
> > >
> > > C = mtimesx(A,reshape(B,6,6,1,1,28));
> > >
> > > > I was getting erroneous values for the elements in the 6x6 matrices when using multiprod.
> > >
> > > I am not familiar enough with multiprod to know the proper input dimensions needed to do the calculation you want in multiprod. Maybe the following will work:
> > >
> > > C = multiprod(A,reshape(B,6,6,1,1,28));
> > >
> > > > I do not have visual basic that allows me to use mtimesx.
> > >
> > > MTIMESX does not need Visual Basic, or anything from Visual Studio. It can be used by anyone with any C compiler that compiles mex routines, and that includes the lcc compiler that comes shipped with MATLAB. You can build MTIMESX on a Windows system as follows:
> > >
> > > - Download from the FEX (I assume you have already done this)
> > > - Copy the files to one of your directories that is on the MATLAB path (see Steve Lord's post).
> > > - Issue the following commands:
> > >
> > > mex -setup
> > > (Wait for the prompt, then press Enter)
> > > (Select a C/C++ compiler, such as lcc)
> > > mtimesx % This will cause mtimesx to self-build
> > >
> > > If you have a Mac or other Unix/Linux type system, the build routine is not automated. If that is the case let me know and I can try to help with this.
> > >
> > > James Tursa
> >
> >
> >
> > James and all,
> >
> > I got MEX to compile and mtimesx to work. I tried the mtimesx suggestion above but it the elements of the 6x6 matrices continued to have the erroneous values. Elements of the 6 x 6 matrices where the values should have been 0 were not.
> >
> > Matrix B is a column with 28 levels of 6 x 6 matrices. I each level in B contains fractions. I want to multiply these columns in B by A which for every hour (24) of everyday (4 days) has columns of 28 6 x 6 matrices.
> >
> > The elements of 6 x 6 matrices in A have unique values for every hour of everyday, however the 28 levels are the same. When I multiply each of level in A by their corresponding level in B each hour and level in A, the values in A are adjusted based on the based on the fraction.
>
> I am unaware of any bugs in mtimesx. In particular, a 6x6 matrix multiply result is obtained by a call to a BLAS library function, the same library that MATLAB itself uses. So I suspect that your problem is not really a matrix multiply problem. Can you post one of your 6x6 matrix example slices from A and B and show what result you would like to obtain?
>
> James Tursa



James,

I have 96 (24 hours for 4 days) matrices similar to the following:

Columns 1 through 5

            0 0 1166.7 1125 0
            0 1125 2500 375 1291.7
            0 1083.3 458.33 1166.7 583.33
            0 0 0 0 416.67
            0 0 0 0 0
            0 0 0 0 0

  Column 6

       458.33
            0
       83.333
       41.667
            0
            0


Each hour contains 28 of the matrix. In the 5-D variable apply250_km2(:,:,4,24,5), the colons are 6 x 6, the 4 is for days 1 to 4, the hours are for 0000 UTC to 2300 UTC, and the 2 is the second of 28 levels.

I want to multiply apply250_km2(:,:,4,24,5) times a 3-D variable lnox_mass_frac(:,:,5) Where the colons are 6 x 6 matrices containing fractions:

 Columns 1 through 5

     0.014881 0.015461 0.010984 0.023592 0.019761
     0.020737 0.021294 0.011896 0.010486 0.015627
     0.022478 0.022408 0.022339 0.022269 0.02213
     0.023105 0.023035 0.022966 0.022896 0.022826
     0.023523 0.023453 0.023383 0.023314 0.023244
     0.023941 0.023871 0.023801 0.023732 0.023662

  Column 6

     0.014549
      0.01629
      0.02213
     0.022757
     0.023175
     0.023592


The 5 is level 5 of 28. Essentially I want to do this apply250_km2(:,:,4,24,5) .* lnox_mass_frac(:,:,5). If the level number (1 - 28 ) does not match, I do not want to multiply it. I should attain this result:

Columns 1 through 5

            0 0 12.815 26.542 0
            0 23.956 29.74 3.9324 20.185
            0 24.276 10.239 25.981 12.909
            0 0 0 0 9.5109
            0 0 0 0 0
            0 0 0 0 0

  Column 6

       6.6683
            0
       1.8441
      0.94819
            0
            0

I think mtimesx and multiprod were doing the * and not .*
I say this b/c the elements of the 6 x6 matrices that contain zeros in apply250_km2 should remain the same after the multiplication. This was not happening.

Thanks,
Jonathan

Subject: how to get multiprod working

From: Bruno Luong

Date: 31 Jan, 2011 12:48:04

Message: 12 of 17


>
> I want to multiply apply250_km2(:,:,4,24,5) times a 3-D variable lnox_mass_frac(:,:,5) Where the colons are 6 x 6 matrices containing fractions:
>

Well, then you don't need MULTIPROD at all.

sz = size(apply250);
sz([3 4]) = 1;
M = bsxfun(@times, apply250_km2, reshape(lnox_mass_frac, sz));

Bruno

Subject: how to get multiprod working

From: Jonathan W Smith

Date: 31 Jan, 2011 17:06:04

Message: 13 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ii6b24$6mn$1@fred.mathworks.com>...
>
> >
> > I want to multiply apply250_km2(:,:,4,24,5) times a 3-D variable lnox_mass_frac(:,:,5) Where the colons are 6 x 6 matrices containing fractions:
> >
>
> Well, then you don't need MULTIPROD at all.
>
> sz = size(apply250);
> sz([3 4]) = 1;
> M = bsxfun(@times, apply250_km2, reshape(lnox_mass_frac, sz));
>
> Bruno

Hello,

Thanks for this fix. This puts me a step closer. I put the bxsfun and bsxarg folders in my path. Mex compiles fine. I get the following message during compilation and after issuing the command: mex bsxarg.c :

>> mex -setup
Please choose your compiler for building external interface (MEX) files:
 
Would you like mex to locate installed compilers [y]/n? y
 
Select a compiler:
[1] Lcc C version 2.4.1 in C:\DOCUME~1\ADMINI~1\Desktop\sys\lcc
 
[0] None
 
Compiler: 1
 
Please verify your choices:
 
Compiler: Lcc C 2.4.1
Location: C:\DOCUME~1\ADMINI~1\Desktop\sys\lcc
 
Are these correct?([y]/n): y
 
Trying to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2006b\mexopts.bat
From template: C:\DOCUME~1\ADMINI~1\Desktop\bin\win32\mexopts\lccopts.bat
 
Done . . .
 
>> mex bsxarg.c
 
  C:\DOCUME~1\ADMINI~1\DESKTOP\BIN\MEX.PL: Error: 'bsxarg.c' not found.
 
??? Error using ==> mex
Unable to complete successfully.

Subject: how to get multiprod working

From: Bruno Luong

Date: 31 Jan, 2011 17:24:04

Message: 14 of 17

"Jonathan W Smith" wrote in message <ii6q5s$iar$1@fred.mathworks.com>...
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ii6b24$6mn$1@fred.mathworks.com>...
> >
> > >
> > > I want to multiply apply250_km2(:,:,4,24,5) times a 3-D variable lnox_mass_frac(:,:,5) Where the colons are 6 x 6 matrices containing fractions:
> > >
> >
> > Well, then you don't need MULTIPROD at all.
> >
> > sz = size(apply250);
> > sz([3 4]) = 1;
> > M = bsxfun(@times, apply250_km2, reshape(lnox_mass_frac, sz));
> >
> > Bruno
>
> Hello,
>
> Thanks for this fix. This puts me a step closer. I put the bxsfun and bsxarg folders in my path. Mex compiles fine. I get the following message during compilation and after issuing the command: mex bsxarg.c :
>
> >> mex -setup
> Please choose your compiler for building external interface (MEX) files:
>
> Would you like mex to locate installed compilers [y]/n? y
>
> Select a compiler:
> [1] Lcc C version 2.4.1 in C:\DOCUME~1\ADMINI~1\Desktop\sys\lcc
>
> [0] None
>
> Compiler: 1
>
> Please verify your choices:
>
> Compiler: Lcc C 2.4.1
> Location: C:\DOCUME~1\ADMINI~1\Desktop\sys\lcc
>
> Are these correct?([y]/n): y
>
> Trying to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2006b\mexopts.bat
> From template: C:\DOCUME~1\ADMINI~1\Desktop\bin\win32\mexopts\lccopts.bat
>
> Done . . .
>
> >> mex bsxarg.c
>
> C:\DOCUME~1\ADMINI~1\DESKTOP\BIN\MEX.PL: Error: 'bsxarg.c' not found.
>
> ??? Error using ==> mex
> Unable to complete successfully.

When you mex-compile a c-file it must be on your CURRENT folder

Bruno

Subject: how to get multiprod working

From: Bruno Luong

Date: 31 Jan, 2011 18:58:04

Message: 15 of 17

If your Matlab version cannot support BSXFUN, you can also do the old way with REPMAT:

dup = size(apply250_km2);
dup([1 2 5]) = 1;
M = apply250_km2 .* repmat(lnox_mass_frac, dup);

I believe BSXFUN on FEX replicates data thus comparable to REPMAT performance wise and not as efficient as the official BSXFUN introduced later.

Bruno

Subject: how to get multiprod working

From: Bruno Luong

Date: 31 Jan, 2011 19:17:04

Message: 16 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ii70ns$67o$1@fred.mathworks.com>...
> If your Matlab version cannot support BSXFUN, you can also do the old way with REPMAT:
>
> dup = size(apply250_km2);
> dup([1 2 5]) = 1;
> M = apply250_km2 .* repmat(lnox_mass_frac, dup);

Oops, there is a mistake

sz= size(apply250_km2);
dup = sz;
sz([3 4]) = 1;
dup([1 2 5]) = 1;
M = apply250_km2 .* repmat(reshape(lnox_mass_frac, sz), dup);

Hope it's alright (I program blindly).

Bruno

Subject: how to get multiprod working

From: Jonathan W Smith

Date: 31 Jan, 2011 20:25:06

Message: 17 of 17

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ii6r7k$6rf$1@fred.mathworks.com>...
> "Jonathan W Smith" wrote in message <ii6q5s$iar$1@fred.mathworks.com>...
> > "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ii6b24$6mn$1@fred.mathworks.com>...
> > >
> > > >
> > > > I want to multiply apply250_km2(:,:,4,24,5) times a 3-D variable lnox_mass_frac(:,:,5) Where the colons are 6 x 6 matrices containing fractions:
> > > >
> > >
> > > Well, then you don't need MULTIPROD at all.
> > >
> > > sz = size(apply250);
> > > sz([3 4]) = 1;
> > > M = bsxfun(@times, apply250_km2, reshape(lnox_mass_frac, sz));
> > >
> > > Bruno
> >
> > Hello,
> >
> > Thanks for this fix. This puts me a step closer. I put the bxsfun and bsxarg folders in my path. Mex compiles fine. I get the following message during compilation and after issuing the command: mex bsxarg.c :
> >
> > >> mex -setup
> > Please choose your compiler for building external interface (MEX) files:
> >
> > Would you like mex to locate installed compilers [y]/n? y
> >
> > Select a compiler:
> > [1] Lcc C version 2.4.1 in C:\DOCUME~1\ADMINI~1\Desktop\sys\lcc
> >
> > [0] None
> >
> > Compiler: 1
> >
> > Please verify your choices:
> >
> > Compiler: Lcc C 2.4.1
> > Location: C:\DOCUME~1\ADMINI~1\Desktop\sys\lcc
> >
> > Are these correct?([y]/n): y
> >
> > Trying to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2006b\mexopts.bat
> > From template: C:\DOCUME~1\ADMINI~1\Desktop\bin\win32\mexopts\lccopts.bat
> >
> > Done . . .
> >
> > >> mex bsxarg.c
> >
> > C:\DOCUME~1\ADMINI~1\DESKTOP\BIN\MEX.PL: Error: 'bsxarg.c' not found.
> >
> > ??? Error using ==> mex
> > Unable to complete successfully.
>
> When you mex-compile a c-file it must be on your CURRENT folder
>
> Bruno


Thanks a lot !! These suggestions were helpful.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us