Answered
strfind first occurrence.
You could use <http://www.mathworks.com/help/matlab/ref/regexp.html |regexp|> with the |'once'| option: k = regexp(str, 'in...

10 years ago | 2

| accepted

Answered
Looping over table variable to access structure
1. Sort your table by decreasing size: tsorted = sortrows(t, 'size', 'descend'); 2. Simply iterate over the rows and use...

10 years ago | 0

| accepted

Answered
Tables: Create new variables by modifying existing ones
Use <http://www.mathworks.com/help/matlab/ref/regexprep.html |regexprep|> to replace patterns (with empty strings in your case),...

10 years ago | 0

| accepted

Answered
Grouped scatter with categorical variables
The error message is fairly clear. |gscatter| tries to order your categories but since they're not ordinal, there is no defined ...

10 years ago | 0

| accepted

Answered
how to find and replace corresponding matri
idx = find(~cellfun(@isempty, a1)); %index of non empty cell assert(numel(idx) == 1, 'There are more or less than 1 empty cell'...

10 years ago | 0

Answered
How to: taking out 2d matrix from 3d matrix
Azzi showed you one way to do it. You could also do z1 = squeeze(z(1, :, :)); z2 = squeeze(z(2, :, :)); the |permute|...

10 years ago | 1

| accepted

Answered
How to determine blocks in mesh grid?
This should work: A = [-1 -1; -1 1; 1 -1; 1 1; -1 0; 0 -1; 0 0; 0 1; 1 0]; %get the sorted unique x and y coordinates: ...

10 years ago | 0

| accepted

Answered
How to compare each content of string which is of type double (matrix) in if loop recursively?
There are no strings in your code at all (You create a string literal by enclosing the text in quotes: |var = 'thisisastring'|)....

10 years ago | 1

Answered
String matching and data extract
I've never seen that exact error message (which version of matlab?) but your code is certainly going to produce an error if ther...

10 years ago | 0

Answered
combination function using ndgrid
function varargout = comb(varargin) varargout = cell(1, nargout); [varargout{:}] = ndgrid(varargin{:}; %distribut...

10 years ago | 0

| accepted

Answered
Load, Process, Rename and Save Multiple Files
folder = 'c:\somewhere\somefolder'; numfiles = 100; multiplier = 5; for fileidx = 1:numfiles oldcontent = load(...

10 years ago | 2

Answered
Implementing a new class,
_" the class above, gets 2 points of geometry and draws a straight line"._ The class you've posted does no drawing whatsoever...

10 years ago | 1

| accepted

Answered
"Index exceeds matrix dimensions."
columnsA=length(A); % number of columns in my dataset A *No it isn't*, |columnsA| may be the number of columns *or* the num...

10 years ago | 0

| accepted

Answered
Array combination using pairs
Assuming you're asking how to generate the <https://en.wikipedia.org/wiki/Cartesian_product cartesian product> of the set [0:15]...

10 years ago | 0

Answered
How can i make my code run faster
Assuming |Distance_Unique|, |Distance|, etc. are all matrices or vectors and not functions, the two inner loops are certainly no...

10 years ago | 1

| accepted

Answered
Dear all, i would like to ask about two codes in Matlab and what they do exactly. one is Figure('color'[1 1 1]) and i dont get what does the 1 1 1 do. the other is pause(0.0000001) and what does this do if its increased or decreased
You know, there's this thing called the <http://www.mathworks.com/help/documentation-center.html documentation> which explains w...

10 years ago | 0

| accepted

Answered
appending zeros to multi-array matrix
The simplest way is to simply put a zero as the last element, in the bottom corner of your 3D matrix. The necessary pages full o...

10 years ago | 0

Answered
How to capture the figure data as a single matrix?
That cdata *is a single matrix* image in RGB form. If you are sure that the image is greyscale then you can use any of the colou...

10 years ago | 0

| accepted

Answered
The number of distint intensity (gray) values in an gray scale image matlab code?
Simply <http://www.mathworks.com/help/matlab/ref/numel.html count> the number of <http://www.mathworks.com/help/matlab/ref/uniqu...

10 years ago | 0

Solved


Isothermal Expansion
Given the initial pressure and volume of an ideal gas, calculate the new volume, given the new pressure. Hint: <https://en.wi...

10 years ago

Solved


Sum two real numbers
It seems easy, but... You cannot use +, -, plus, diff, cumsum, *, prod, times, etc.

10 years ago

Solved


Does this dress make me look fat
For the input string "Does xyz make me look fat" output the string "No, xyz does not make you look fat"

10 years ago

Solved


Fifteen Parity Check
The Matlab function fifteen initializes the 4x4 array with randperm(16), which produces 50% unsolvable puzzles. A <https://en.wi...

10 years ago

Answered
Newbie question about date format
Assuming your cell array is an array of string, you would have to convert it first to datenum or datevec and then back to datest...

10 years ago | 0

Answered
Matrix dimensions to create for loop?
I'm not sure why you can't use a loop: V = zeros(size(rr)); denum = eye(size(rr, 1), 1); %so it's not recreated 200 time...

10 years ago | 0

| accepted

Answered
how I can know if a string is empty or not!?
How about the helpfully named <http://www.mathworks.com/help/matlab/ref/isempty.html |isempty|>?: >>isempty('aaa') ans =...

10 years ago | 1

| accepted

Answered
Reverse Input Image coordinates
That's because Mathworks couldn't stick to just one coordinate system, and that's very maddening. Because an image is a matri...

10 years ago | 1

Answered
Create an array of n function handle
I'm not sure why your anonymous functions take a |t| input that they don't use. Anyway: funN = @(~, x, k, N) reshape(x(1:N)...

10 years ago | 0

Answered
hourly average of multiple column data
Use <http://www.mathworks.com/help/matlab/ref/accumarray.html |accumarray|>: m = [1 1 10 20 1 1 20 40 1 2 ...

10 years ago | 0

Answered
load multiple mat files for plot
figure; hold on; for fileidx = 1:n filedata = load(fullfile('C:\location\of\the\files', sprintf('data%d.mat', fil...

10 years ago | 0

| accepted

Load more