Write a function called valid_date that takes three positive integer scalar inputs year, month, day. If these three represent a valid date, return a logical true, otherwise false. The name of the output argument is valid.
Looks like you are taking the same class as Rahul. Rather than repeat my answer here, I will simply direct you to the link: ht...

| 採用済み

sum of multiplication for a vector and matrix
result = sum(b*A);

I need some help in seeing where I am going wrong and how to proceed with writing a particular funciton for a MATLAB course I am taking please.
Some issues: n is a fixed input ... you should not be changing n inside your function. Get rid of that n = n + 1 statement. T...

| 採用済み

Use of int vs size_t in mex compilation of C-function dgemm.
If you are linking to the MATLAB supplied BLAS/LAPACK libraries, then all of the integer types being used for arguments to these...

2ヶ月 前 | 0

| 採用済み

For loop to extract every 3rd column out of matrix and assign as variable name
Do not do this! This will only lead to headaches downstream in your code for processing these variables (you will need to use m...

2ヶ月 前 | 1

| 採用済み

random generator on level of bytes
Generate random integers and then multiply them by 8 to guarantee that the result is divisible by 8. E.g., something like: max_...

2ヶ月 前 | 3

| 採用済み

Calculate sum of series using for
Here is an outline to get you started: a = something; % you put a value here m = something; % you put a value here x = someth...

2ヶ月 前 | 1

| 採用済み

Decimal to Binary Conversion
E.g., bstream = reshape(b',1,[]); If you want characters, then bstream = char(reshape(b',1,[]) + '0');

2ヶ月 前 | 1

| 採用済み

How to output a vector/array from a created function
Don't use size(inputVector) for your loop indexing limits since this is a vector. Use numel(inputVector) instead. Also, you sho...

2ヶ月 前 | 0

Cpp to Mex conversion
Looks like you have a mismatch with variable types, probably an older piece of code that you are trying to compile on a newer MA...

2ヶ月 前 | 1

| 採用済み

mxGetPropertyPtr & mxSetPropertySDC C-mex functions
Fast memory efficient alternative to API functions mxGetProperty & mxSetProperty.

2ヶ月 前 | ダウンロード 2 件 |

how to solve 'Error using | Matrix dimensions must agree. ' ?
Maybe this line: while (Lia2_One_Three ~= zeros(length(Lia2_One_Three),1) | Lia2_Two_Three ~= zeros(length(Lia2_Two_Three),1)...

2ヶ月 前 | 0

| 採用済み

Print from C file into Command window via MexFile
"However I would like to print directly from the c-file to Matlab Command Window. Is that possible?" Yes, that is what mexPrint...

2ヶ月 前 | 1

| 採用済み

could anyone help me to solve the issue with respect to the code
The syntax of a for-loop is: for k=1:5 % your code here end

2ヶ月 前 | 0

Subtracting matrices using a for loop
diff(your_data,1,3)

2ヶ月 前 | 0

How can I see the filter function implementation code at MATLAB?
In general, if the function has an associated .m file then TMW is willing to show you that much. Also there may be information ...

2ヶ月 前 | 1

If else problem for year
All of those if-elseif blocks make the code difficult to read, and difficult to debug as well. I would advise against that appr...

2ヶ月 前 | 0

| 採用済み

Please how can I store all my matrix?
Maybe use a cell array: channel{i} = [importdata(location)]; Then at the end you can work with the individual matrices as chan...

2ヶ月 前 | 1

| 採用済み

Fast Elementwise Matrix-Multiplications
The element-wise times operation in MATLAB is already multi-threaded. You are not going to beat it by writing your own low leve...

2ヶ月 前 | 0

Defining velocity over particular time frame
You don't need a loop for the velocity. Assuming I understand that you want the velocity to be linear, you just need a vector t...

3ヶ月 前 | 0

| 採用済み

Converting C++ bits packed int** to MATLAB unisgned char mxArray using mex?
Some issues: 1) The signature of mxCreateNumericArray according to the doc is: mxArray *mxCreateNumericArray(mwSize ndim, cons...

3ヶ月 前 | 0

| 採用済み

Find an optimal solution for a linear system with two inequations
The way you have this problem posed, and assuming by "binary" you mean integer, it can be solved by simple inspection. The max ...

3ヶ月 前 | 0

How to formulate the random matrix between real interval?
See the second example in the rand doc here, and use your endpoints of 0.10 and 0.50 instead of the example endpoints of -5 and ...

3ヶ月 前 | 0

| 採用済み

Complex matrix inversion using LAPACK in MEX
I took your code and modified it to be a mex routine that takes a 2D double complex input (caution: no argument checking done!) ...

3ヶ月 前 | 0

how to reshape this matrix
result = reshape(A.',2,[]).'

3ヶ月 前 | 0

| 採用済み

Simulation of irrational numbers
The random number generators that come with MATLAB have very long periods. You can simply use them to form your ratio and it wi...

3ヶ月 前 | 0

Printing out the element values in a mxDouble array (C++ script in Matab)
%d is a decimal integer format for use with short, int, long, etc. This doesn't work with floating point. Try e.g. %f or %g inst...

3ヶ月 前 | 0

| 採用済み

Runge-Kutta function
Here is some code to get you started. It receives a string from the user for a derivative function of x and t and turns it into...

3ヶ月 前 | 1

for loop continued fraction
Yes, you can use the formula x(n) = 1 + 1/x(n-1) if you want to use a loop. Just start with x(1) = 1.

3ヶ月 前 | 0

How to sum up multiple vectors, element by element, to recieve one final value?
The numerator is just a simple dot product between two vectors, and the denominator is just a simple sum. Using the fact that a...

3ヶ月 前 | 1