Solved


Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

10 years ago

Solved


Pangrams!
A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

10 years ago

Answered
MySql datainsert/ fastinsert problem
Hi Sal, when you write a single entry to one column, then this will add a row to your table, and all the other columns will g...

10 years ago | 0

Answered
Assign value to array structure
Hi, this should work: valuesCell = num2cell(ValuesToAssign); [StructArray.field_1] = valuesCell{:}; Titus

10 years ago | 1

| accepted

Answered
Problem with HitTest. I can not zoom on ax1 when ax2 is on top of it. The code works in Matlab 2012b.
Hi, I'm not yet sure, why this happens. Programmatically you can change the behavior to the desired as follows: hz = zoo...

10 years ago | 0

Answered
Crank-Nicolson finite difference method - Error: Function definitions are not permitted in this context.
You need to save the code to a file, then call it ... Titus

10 years ago | 0

Answered
Some tunable variables are missing in generated S-function mask
Hi Benjamin, note, that there are blocks in Simulink that don't allow the value to be tunable (all sample time related parame...

10 years ago | 0

Answered
Find minimum of double-variable function on fixed interval
Hi, just to be sure: your y is dependent both on G and r and you want to minimize on the square [0..1]x[0..1]? In this cas...

10 years ago | 0

Answered
How to get each plane of a 24 bit plane image?
Hi, maybe this function could help? function p = getPlane(im, idx) % look for planes 1..24 assert(idx>0 && idx<=24) %...

10 years ago | 2

Answered
What does it mean when they wrote something like this: f{t} = @(z) f_m(z, m(t)) :
Hi, search the documentation for function_handle The first hit is what you are looking for. In short f_m = @(z,c...

10 years ago | 0

| accepted

Answered
Removing certain lines of text from a cell array
Hi, that should be fairly straight forward: % find the indices of ESO idx = strncmp(N1, 'ESO', 3); % and remove th...

10 years ago | 0

| accepted

Answered
Mex compiled function, used to compute set intersection and difference, keeps crashing
Hi, I'm not 100% sure why it crashes, but that's at least a good way to create memory leaks ;-). You should replace the mx...

10 years ago | 0

Answered
The expression to the left of the equals sign is not a valid target for an assignment.
Hi, that's the maple notation. Use the following: syms x S=int(sin(cos(x)), x, 0, 1) Then it should work, although t...

10 years ago | 0

Answered
Unusual set_param error with system
Hi, note, that there is a line break. This should work: set_param(sprintf('R_edge_detect/Subsystem\n/Filt'), 'SampleTime...

10 years ago | 0

| accepted

Answered
Is there a way to have a MATLAB script run automatically as a result of some event?
Hi Nicholas, the simplest I guess is to create a timer that * looks for a new file * starts your script, if it finds one...

10 years ago | 0

| accepted

Answered
Global Optimization not returning correct values
Hi Jacob, you mean similar to this? x = 1:5; y = polyval([1 0.5 0.25], x); polyfit(x, y, 2) ans = 1.0000 0.50...

10 years ago | 0

Answered
How can I calculate a Integral.
Hi, use the trapz function: trapz(Time, Error) Titus

10 years ago | 0

| accepted

Answered
Cant find roots with fzero
Hi, either do what Torsten suggests, or create a function handle instead of using syms: Qbalance = @(T) (258511136443766...

10 years ago | 0

Answered
Unexpected matlab expression???? How to Solve???? - URGENT!!!!!
a = @(m) sqrt(...) Titus

10 years ago | 2

| accepted

Answered
How can do intersection and union of two vectors?
Hi, did you try to enter union or intersect in the documentation search? It should give you at least for the intersection a g...

10 years ago | 0

Answered
How to convert binary image to RGB image in matlab?
Hi, you need to replicate the bw image for each color channel, convert to uint8 and multiply by 255: J1 = 255 * repmat(u...

10 years ago | 3

Answered
I have a 1000 element vector. I want to know if it has got any of its 2 or more elements equal. Is there a command to check this?
Hi, the easiest is to use unique x = [1 1 2 3]; if numel(x)~=numel(unique(x)) disp('There are repetitive element...

10 years ago | 0

| accepted

Answered
Can I call a bash shell script (using cygwin) through matlab?
Hi, you can use the system function to call your shell script. Something like location = 'Germany'; system(['yourshel...

10 years ago | 0

Answered
How to change directory to write-able one and still be able to compile using a C- compiler?
Hi, take a look <http://www.mathworks.com/support/compilers/R2015a/index.html here> for supported C-compilers (left is "previ...

10 years ago | 0

Answered
Matlab Coder C++ matrix multiplication issue
Hi, note that MATLAB uses column format for storing arrays, so you need to initialize double X[]={2,5,4,6}; double Y[...

10 years ago | 1

| accepted

Answered
how to make function that return struct vector whose elements are days of month
Hi Muhammad, a hint: doc weekday Titus

10 years ago | 0

Answered
Given a named function, how can I call this function, and not the subfunction of the same name?
Oliver, what about this: feval(evalin('base', '@(x) help(x)'), 'help') This works fine. And as you noted yourself...

10 years ago | 1

| accepted

Answered
How to check the existence of a non-existent handle
Hi Klaus, I guess isfield(handle, 'a') && ishandle(handle.a) is what you are looking for ...? Titus

10 years ago | 7

| accepted

Answered
Given a named function, how can I call this function, and not the subfunction of the same name?
Hi Oliver, although this is not an answer to your question it might help anyway: this is one of the reasons to use function h...

10 years ago | 0

Answered
Simulating C MEX S-Function causes crash (Level 2)
Hi, the <http://www.mathworks.com/help/matlab/troubleshoot-mex-files-1.html documentation> describes how to debug mex files. ...

10 years ago | 0

Load more