Answered
How to save a text annotation on an image photo
If you have the Computer Vision Toolbox, you can insert your text into the image with <https://www.mathworks.com/help/vision/ref...

8 years ago | 0

Answered
Generate a dummy with a cell
dummy = strcmp(category, 'beef & Pork')

8 years ago | 1

| accepted

Answered
Replace Values that Meet a Condition - 3D Matrix
mask = X(:, :, 1) == 1 & X(:, :, 2) == 0 & X(:, :, 3) == 0; %fully saturated pure red mask = repmat(mask, 1, 1, 3); %repl...

8 years ago | 1

| accepted

Answered
compare two columns and retrive joint values
[found, where] = ismember(B1, A1); %note the order of the inputs! assert(all(found), 'Some values of B1 not in A1'); C...

8 years ago | 0

| accepted

Answered
create a matrix of all possible combinations of 4 projects formed
Project = [1; 2; 3; 4]; Cost = [4; 8; 10; 8]; Benefit = [3; 4; 3; 2]; M = dec2bin(0:2^numel(Project)-1) - '0'; %ge...

8 years ago | 0

| accepted

Answered
Stop program after image closes
One possible way is to create the figure before starting your loop, keep its handle and check that it's not been deleted (which ...

8 years ago | 1

| accepted

Answered
search for keywords in text file
* You're overwriting your |matchstring| variable in the second |regexp| call, losing the result of the first call. * your |ma...

8 years ago | 1

| accepted

Answered
How can I vectorize copying one struct to another?
events = num2cell(p.Results.events); %convert array to cell array so that it can then be converted to comma separated list ...

8 years ago | 2

| accepted

Answered
how can i write a matrix into a single row of excel sheet?
Simply |reshape| your matrix into a row vector before passing it to |xlswrite|: xlswrite(filename, reshape(yourmatrix, 1, [...

8 years ago | 0

| accepted

Answered
Storing the results from nested loop
You could of course not bother with the loops at all: a = 0:3; b = a(1)+1:6; %too many elements, the extra will be remo...

8 years ago | 1

Answered
Apply logical cell to a cell
result = cellfun(@(a, b) a(b), A, B, 'UniformOutput', false) will produce a 100x1 cell array of *vectors* (since filtering ...

8 years ago | 1

| accepted

Answered
How can I create a random vector with at most 1 in it?
Another option: v = randperm(n) == n or v = randperm(n) == 1

8 years ago | 0

| accepted

Answered
Error using pdist to calculate euclidean distance .
_So what should be the way forward ?_ Don't use the same name as matlab functions for your own function. The way forward is t...

8 years ago | 0

| accepted

Answered
How to take out a range of values from matrices within a cell with a for loop?
_I gave a general example in the question because if someone provides an answer I can fix those values myself_ Yes, but there...

8 years ago | 0

| accepted

Answered
please solve my error am new one to matlab..!!
Clearly |tau| and |eta| don't have the same number of columns (or |alpha| or |beta| are column vectors with different length). ...

8 years ago | 1

| accepted

Answered
Overload operator doesn't work into workers
I don't know the reason for the particular error you get but you will always get an error anyway since your code *is not paralle...

8 years ago | 0

Answered
How do I use MatLab to loop through many folders and extract columns of data from .txt files in those folders?
Rather than handling the parsing of folders, subfolders, and text files yourself, you could let matlab handle all of that for yo...

8 years ago | 2

Answered
Replacing numbers in an matrix in one line
_I'm going to be doing this on about 10000 signals_ You can apply the operation to all signals at once. This would probably g...

8 years ago | 0

| accepted

Answered
How can I save multiple matrices from text file?
There are many ways to do this, here is one option: contents = fileread('results.txt'); %read whole file at once conten...

8 years ago | 1

| accepted

Answered
I got a value followed by a program, I want to print some message by using switch statement. I wrote some code , but wrong case is working.
You are inventing your own syntax for |switch|, it's no wonder it doesn't work. While there is a way to make your tests work...

8 years ago | 0

Answered
How to understand the Memory [Maximum posible Array] result ?
As per the documentation you've quoted each element of a |double| array uses 8 bytes. So a 3x3x3 |double| array would be 27x8 = ...

8 years ago | 0

Answered
Spliting an image into 4 blocks and apply a function to each block
I strongly suspect that your |blockArray| is meant to be a cell array, hence dthe line blockArray = [upperLeft, lowerLeft,u...

8 years ago | 0

| accepted

Answered
How to avoid for nested loops with if condition?
You certainly don't need the |j| loop: for row = 1:size(id) id(row, x(id(row, :) == 1 & RR(row, :) == 1)) = 0; end...

8 years ago | 0

| accepted

Answered
Am I allowed to write functions that have names of matlab functions (copyright)?
Something that has not been touched on: while the name of a function is not copyrightable, the function API (function name + inp...

8 years ago | 0

| accepted

Answered
How can I ensure no repeated adjecent values in a vector?
This is how I'd do it: while true %run until we get an acceptable sequence. break will quit the loop test = (randpe...

8 years ago | 0

| accepted

Answered
How to open/run/control an .exe application using Matlab on windows OS?
|actxcontrol| is used to embed com (activex) controls into a matlab GUI. These would not come as .exe but as .dll or .ocx. |a...

8 years ago | 0

Answered
How to make a list of coordinates out of two lists in Matlab?
Use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: x = [1,2,3]; y = [4,5,6]; z = zeros(10, 10); ...

8 years ago | 0

| accepted

Answered
Concatinate text (header) and numbers
A much simpler approach is to use the modern <https://www.mathworks.com/help/matlab/ref/readtable.html |readtable|> instead of t...

8 years ago | 1

| accepted

Answered
Can I call a function defined within another function .m file?
As is, it is not possible. Local functions can only be accessed from within the files where they are defined. The only way to...

8 years ago | 1

| accepted

Answered
Faster way to match up dates with data?
Well, yes your code is extremely inefficient. ideal_obs = zeros(numel(date_time_index), 3); [isfound, where] = ismember...

8 years ago | 1

| accepted

Load more