Respondida
How do I search through a tall array element by element?
tall arrays are not "in memory". As such, they cannot be used for controlling "if" and "while" statements since their values (a...

más de 9 años hace | 0

Respondida
Could anyone give an idea to write code to solve below problem
You could create a function file and put your loop code inside that file which takes a guess as an input (for Tc(1)) and returns...

más de 9 años hace | 0

| aceptada

Respondida
2nd Order ODE with RK4 hard code (w/o) built-in Matlab fuctions
You've got your step sizing messed up a bit. Suggest the following changes: % h = 1/n; %time grid % t = linspace(0,10,r...

más de 9 años hace | 0

Respondida
How should I mex a fortran code(main function) that calls other fortran codes(sub function) that in different files
The modules need to be compiled first so that the interface .mod files are available for the downstream compiling. This can be ...

más de 9 años hace | 0

Respondida
Operands to the || and && operators must be convertible to logical scalar values. Im not sure what i did wrong. Any help would be greatly appreciated.
The way you have F defined, it will return a vector since it uses x and x is a vector. This is causing the error. You need to ...

más de 9 años hace | 0

Respondida
please, can anyone tell me the solution of this differential equation in matlab "D2y + 4Dy + 3*y = exp^(2*x)"
One particular solution found by inspection, assuming I understand your equation, is: y = exp(2*x)/15 And the homogeneous so...

más de 9 años hace | 0

Respondida
I am trying to create a mex file for FORTRAN90 code. I get an error because of '&' and long sentences in the FORTRAN90 code
This is usually caused by TMW including a compiler option in the mex option files to force fixed field source even if the file h...

más de 9 años hace | 0

| aceptada

Respondida
[Homework Help] Stuck with result. && use not working as intended (easy?)
Here is what I get, after changing your != operator to a ~= operator: >> X=[1, 2, 3, 4] X = 1 2 3 4 ...

más de 9 años hace | 1

| aceptada

Respondida
How to create a weighted average for the following data?
One way: result = sum(bsxfun(@times,reshape([Avg.population],1,1,[]),reshape([Avg.average],15,15,[])),3)/sum([Avg.populatio...

más de 9 años hace | 0

Respondida
Matrix dimensions must agree - 3 chances loop
Your fundamental problem is how you are doing string compares. Do not use the == operator since that is an element-wise operato...

más de 9 años hace | 0

| aceptada

Respondida
Retreiving property value of each object in array
Maybe use a cell array instead? listOfNames = {handles.library.name};

más de 9 años hace | 1

| aceptada

Respondida
How to modify a struct and create a new struct out of it?
One way, but note there will be loops in the background: X = [A.X]; Y = [A.Y]; Z = [A.Z]; [theta,phi,r] = cart2sph...

más de 9 años hace | 0

Respondida
How to transform an array from n x m into nm x 1?
B = A.'; B = B(:); or B = reshape(A.',[],1); In both cases, the transpose is necessary to get the elements of A ...

más de 9 años hace | 0

| aceptada

Respondida
I have a vector with M elements. And I want to divide it into parts, with "n" elements each. How do I do that?
I guess the obvious answer, if n is evenly divisible into M, is simply to reshape it v = your M-element vector parts = r...

más de 9 años hace | 0

Respondida
how to create a 1x3 cell array to hold multiple individual arrays
my_cell_array = {a,b,c}; Or if you are simply asking how to pre-allocate the cell array in advance: my_cell_array = ce...

más de 9 años hace | 1

| aceptada

Respondida
Help passing column vector of doubles to function to get letter grade for all grades
Call your function in a loop for each element of n, or put code inside your function to loop over all the elements of n. For th...

más de 9 años hace | 1

| aceptada

Respondida
I'm attempting to write a function that calculates the value of sine using a taylor series to within a tolerance of 10^-6. I think my loop is set up correctly but i'm not sure the series equation is correct as my function never stops running.
You are close, but have a few errors. The errors are: 1) The exponent on x should be 2*n+1, but you have 2*(n+1), which isn'...

más de 9 años hace | 1

| aceptada

Respondida
Write matrix with Matlab and Read with C?
Use fopen, fwrite, fread. EXAMPLE: m-code: xbinary_create.m x = 1:5; fid = fopen('xbinary.bin','w'); fwrite(fi...

más de 9 años hace | 0

Respondida
Matrix Multiplication Using For Loop
The error message is pretty clear. You are attempting to build the x variable out of four other variables named x1, x2, x3, x4....

más de 9 años hace | 1

Respondida
Struct contents reference from a non-struct array object.
Issue the following command: dbstop if error Then run your code. When you encounter the error, the code will pause. Exam...

más de 9 años hace | 0

Respondida
what is meant by 'Cell contents reference from a non-cell array object'.
It means you used the curly braces { } on a variable that was not a cell array. E.g. >> x = {5} % <-- a 1x1 cell array, t...

más de 9 años hace | 1

Respondida
Unexpected matlab expression error
For function definitions, you need to have variable names for the input argument list, not explicit values. E.g., this line ...

más de 9 años hace | 0

Respondida
Invalid MEX-file 'D:\sky_detector\toolbox\bin\gco_matlab.mexw64': The specified procedure could not be found..
It is not unusual for mex routines to be dependent on the MATLAB version. I.e., mex routines compiled under one version of MATL...

más de 9 años hace | 0

Respondida
How can I solve a matrix differential equation within MATLAB?
E.g., if you are using ode45, then simply reshape F and the initial Fo into column vectors. Inside the derivative routine, resh...

más de 9 años hace | 12

| aceptada

Respondida
While loop - display the last value while statement is still true
You could just use another variable. E.g., y x=0 p=1-poisscdf(1,x); while p<=0.1 y = x; % <-- save current v...

más de 9 años hace | 1

| aceptada

Respondida
How do I delete columns from a matrix based on an array
A(:,ismember(A(1,:),B)) = [];

más de 9 años hace | 2

| aceptada

Respondida
How to access Matlab string() data in MEX/C?
I don't have a recent enough version of MATLAB & C compiler to check this, but I suspect that the string class is an OOP classde...

más de 9 años hace | 1

Respondida
Only first for loop is being executed. What im i doing wrong?
It is a bit unclear why you are attempting to use for-loops here. From the looks of things, it appears that maybe you need to u...

más de 9 años hace | 1

| aceptada

Respondida
output from an if statment
These statements: zn=cell(1,fx); zn(l)=zs(1); The first statement above wipes out any previous values/cells...

más de 9 años hace | 0

Respondida
Putting different outputs in one vector matrix
Is this what you want? x = 1:9; % a vector with elements 1, 2, ..., 9 y = sin(x) - cos(x); % the vector result at each...

más de 9 años hace | 0

| aceptada

Cargar más