Answered
How do I open files whose name matches a string from another file name?
Assuming timestamps are all of the same form, you can find them with <http://www.mathworks.com/help/matlab/ref/regexp.html |rege...

10 years ago | 1

| accepted

Answered
How to vertcat without repeating the labels in MATLAB?
The simplest solution is not to use |xlsread| which puts everything in a cell array, but to use |readtable| which puts everythin...

10 years ago | 1

Answered
Misleading wording in the documentation on Matlab package (+) folders.
It does say in the documentation that you've linked under _Referencing Package Members Within Packages_ that _"All references to...

10 years ago | 9

| accepted

Answered
How do I reshape a raw data matrix?
This sounds like a job for <http://www.mathworks.com/help/matlab/ref/unstack.html |unstack|>: newtable = unstack(t(:, {'upd...

10 years ago | 1

| accepted

Answered
How to allocate the content of a M*1 vector to a T*N matrix (M<T*N) ? problem with cell format
If I understood correctly, this should work: [udate, ~, drow] = unique(date); %udate could be replaced by ~ if you don't wa...

10 years ago | 0

| accepted

Answered
add path in matlab folder
Just specify the path with the filename. You can use <http://www.mathworks.com/help/matlab/ref/fullfile.html |fullfile|> to buil...

10 years ago | 0

Answered
merging two cell type matrix
This is probably much simpler than Andrei's answer. I assume you meant to use |strcmp| in your original example: IndexC_min...

10 years ago | 3

Answered
The Value assigned to variable 'C' might be unused??
You create a |C| matrix by vertically concatenating three matrices/vectors on your first |C| equation. On the next line, you cre...

10 years ago | 2

| accepted

Answered
how to add element in a vector ?
The simplest way would be to generate all 20 random matrices in one go as pages of a 3D matrix: A = [ 1 1 0 1 0 ...

10 years ago | 0

| accepted

Answered
find combination of labels
Here is one way to do it. Note that I'm using |ndgrid| to generate all the combinations. If you have too many locations and labe...

10 years ago | 2

Answered
string to double when string contains a / sign.
You can use <http://www.mathworks.com/help/matlab/ref/str2num.html |str2num|> which |eval| the string, instead of |str2double|. ...

10 years ago | 0

| accepted

Answered
Slow Find Loop no vectorisation
I don't think you can get rid of the colour loop, but you can speed up the loop code with: [y_pos, x_pos, z_pos] = ndgrid(1...

10 years ago | 0

Answered
Join two tables with the same headers
just vertically concatenate them: newtable = [table1; table2]; %note the semicolon for vertical concatenation %or ne...

10 years ago | 9

| accepted

Answered
how to preallocate the variable in matlab code?
Since your loop runs from 0 to |k| and you're using the loop index + 1 to assign to area, its maximum size is going to be |k| co...

10 years ago | 1

Answered
Adding valies from a table into a zero matrix
A loop is totally overkill for this. There are two simple ways of obtaining your final output: 1. <http://www.mathworks.com/h...

10 years ago | 0

Answered
actxGetRunningServer with multiple instances of Excel running
_"“When multiple instances of the Automation server are running, the operating system controls the behavior of this function.”_ ...

10 years ago | 0

| accepted

Answered
find a cell array of strings in another cell array of strings
<http://www.mathworks.com/help/releases/R2015a/matlab/ref/ismember.html |ismember|> is the function that tells you if elements o...

10 years ago | 0

Answered
using for loop how can i print values between 1 to 10 and 15 to 25 and 27 using one for loop?
When you write |1:10|, you are in effect passing the vector |[1 2 3 4 5 6 7 8 9 10]| to the for loop. You can pass whatever vect...

10 years ago | 0

Answered
Repeating blocks of N rows M times
Another option: A = reshape(1:18,3.,[])'; N = 2; M = 2; reshape(repelem(reshape(A.', size(A, 2)*N, []), 1, M), siz...

10 years ago | 1

Answered
Sort matrix based on unique values in one column
I'm not sure what you mean by _"and everything else needs to be deleted"_. Does that means that rows with identical first column...

10 years ago | 1

Answered
Hi guys, I am a newbee to this forum. But I am kind of familiar with matlab. Recently I have solved my laser rate equation
You cannot create functions within scripts. Save your function in a separate file called 'rate_eqn.m'

10 years ago | 0

Answered
Steps between to elements of a matrix
It sounds like you are trying to compute: bwdist(A, 'chessboard') Note that this requires the image processing toolbox.

10 years ago | 0

Answered
Error using vertcat. Dimensions of matrices being concatenated are not consistent.
The error message is clear. You're vertically concatenating a matrix with |c| columns, |ones(1, c)| with a matrix with a differe...

10 years ago | 0

| accepted

Answered
Exchange data from Workspace struct
This is one of the rare case where |deal| is useful: [data.data] = deal(y); Note that your structure is called data and...

10 years ago | 1

| accepted

Answered
Why am i getting unusual plots when using the sin() and cos() function?
Think about it: |sin(2*pi*k)| with |k| *integer* is equal to |sin(2*pi)|, so is always zero. The fact that your sin plot is n...

10 years ago | 1

Answered
Is there a way to store a picture with im2double with a contrast interval?
newpicture = (double(picture)-100) / (250-100); newpicture(newpicture < 0) = 0; newpicture(newpicture > 1) = 1; would...

10 years ago | 0

Answered
Extracting fields from structures with varying names.
As per my comment to the accepted answer, |save| and |load| is the most inefficient way of solving your problem (and could fail ...

10 years ago | 0

Answered
Change accumarray mean to median
You can specify the accumulating function in |accumarray|. If you do that for |mean|, you don't even need to calculate your |N|:...

10 years ago | 0

| accepted

Answered
find how many times sequences are present in a string array
Here is one way to do it: First, convert |T| into a matrix of number with |str2double|. The empty strings will be converted ...

10 years ago | 0

| accepted

Answered
ConstructOnLoad attribute for custom event.EventData objects?
The relevant documentation about ConstructOnLoad is at <http://www.mathworks.com/help/matlab/matlab_oop/passing-arguments-to-con...

10 years ago | 1

| accepted

Load more