Answered
create a vector whose elements depend on its previous elements without a loop
Doing this will a loop shouldn't be slow as long as you preallocate the array beforehand: a = zeros(1, 100); %preallocation a...

6 years ago | 1

| accepted

Answered
Find the difference between rows and substract it
I'm not sure how that is diferent from shiftng to 0, but to achieve what you want: shift = Amtx1(1, :) - min(Amtx1(1, :)); plo...

6 years ago | 0

| accepted

Answered
Rename files within multiple subfolders (within multiple subfolders) to the name of the first subfolder.
You just need to break down the mydir.folder into its different folders and use the one before last to rename your file.: dir_p...

6 years ago | 0

| accepted

Answered
Edit header of MAT-File
Ok, you could theoretically store some limited metadata in the header of a version 5 mat file. It's been a while now that matlab...

6 years ago | 0

Answered
How to find the peaks without using findpeaks function?
There are several alternatives to the Signal Processing Toolbox findpeaks on the file exchange. This one and this one are the f...

7 years ago | 0

Answered
Use one matrix to change values of another
Simply: B(~ismember(B, A)) == 0

7 years ago | 1

Answered
Google number of occurences
This doesn't seem to be a question about matlab (much). If you want to use google, you'll have to go through their custom search...

7 years ago | 1

Answered
Access multiple folders and extract specific files
Doesn't sound particularly complicated. For a while now, dir has been able to recurse into folders, so a single filelist = dir(...

7 years ago | 0

Answered
Regexp to pull numerics only
\d*\d*\d*\d* is exactly the same as \d*, match 0 or more digits. It probably would be better as \d+, match 1 or more digits Tha...

7 years ago | 0

| accepted

Answered
Transfer a diagonal matrix
Please, don't post screenshot for something as simple as a matrix. Use text, so we can copy/paste it into matlab. A = diag(1:3)...

7 years ago | 0

| accepted

Answered
Importing table/array from website to Matlab
First, note that importing data from html is always going to be very iffy. html is a presentation format designed to display thi...

7 years ago | 0

| accepted

Answered
setvartype does not work
As it says on the 3rd line of the documentation, opts = setvartype(opts,type) "updates all the variables in the opts object ..."...

7 years ago | 1

| accepted

Answered
Decode JSON into only struct array
jsondecode is certainly never going to convert a json array into a structure array as there's no guarantee that the objects in t...

7 years ago | 2

| accepted

Answered
Using color in strings in MATLAB AppDesigner in UITextArea
Unfortunately, no the control is not flexible enough to allow this. On the other, text area controls are more tailored for inp...

7 years ago | 1

Answered
How can I replace this a value in the array with the k where the value is k-th min?
This is the simplest: v = [1 434 22 434 23 53 89 199] [~, ~, newv] = unique(v)

7 years ago | 1

| accepted

Answered
Which way of programming is more efficient and faster?
No, there is no difference between the cases. More importantly, even if there was, you shouldn't care until you've proven that t...

7 years ago | 1

| accepted

Answered
Index exceeds the number of array elements (0).
Yes, you will receive this error whenever your dir doesn't find any file. Three things: Use meaningful variable names, dirconte...

7 years ago | 2

| accepted

Answered
Gray Color Intensity fill.
Note that AFR should hav one less row as well as column. Probably, the simplest way to create your spray: pdata = surf2patch(S...

7 years ago | 1

| accepted

Answered
How to get the sum of several sets of nonzeros in array
Here is one way: %demo data v = [0 0 0 0 2 4 1 0 0 1 5 3 0 0 0 0 2 3 0 0 7 2 3 1 2 0 0 0 0]; endruns = find(diff([v~=0, 0])...

7 years ago | 0

| accepted

Answered
Overwrite a CELL-ARRAY
As Geoff said, at the moment this line vtec_final{1,i} = vtec_pronosticado2 ; doesn't make much sense. We have: for i=1:punt...

7 years ago | 0

Answered
How to be able to read file names with Swedish characters (ÅÄÖ) from a zipped file? Also how to unzip the files to a folder with the same name as the zipped folder?
The documentation of unzip is a bit unclear on the effect of locale, all it has to say is "To extract a zip file that contains n...

7 years ago | 0

Answered
Accessing the index of a matrix element inside the cell array
First, a few recommendations. If you're using vectors use linear indexing instead of 2D indexing. I.e. X{1} instead of X{1, 1}...

7 years ago | 1

| accepted

Answered
degrees2dms Syntax
function(x) = y has never and never will be valid syntax in matlab. A function call is always on the right hand side of the =. ...

7 years ago | 0

| accepted

Answered
Error:- Index in position 1 is invalid. Array indices must be positive integers or logical values.
Note that the whole code can be simplified to: function [ irradianceReorder ] = reOrderNew(irradiance, xMoved, yMoved, zMoved) ...

7 years ago | 0

Answered
A file called avehighs.dat stores the average high temperatures for each month for a year (rounded to integers). The first column of the data stores the zip code, the 2nd to 13th columns store 12 temperatures.
If there was 100 zip codes, would you write a 100 elseif ? What if there was a million? Clearly that's not the way to go You ac...

7 years ago | 0

Answered
Return the Coordinates of the differences
Sounds like you're doing image registration. Have you considered looking at the functions that matlab already provides? There's ...

7 years ago | 0

Answered
How to plot according to DropDown menu value?
if value == Square Well, this is certainly not going to work (unless you've created a Square variable) I suspect that if valu...

7 years ago | 0

Answered
Help!!! how to search for some xx xx xx xx(hex) in a dat file very fast!!!
Unlike per isakson, I'm assuming that you're looking for a byte pattern (given in hexadecimal format) in a binary file. If you'r...

7 years ago | 1

| accepted

Answered
How to make my function accept input file?
What should be done? I'm afraid the answer is: learn matlab. Function inputs are variables. Matlab is not going to magically gu...

7 years ago | 2

Answered
The sequence of actions in a vector (football match)
No idea how we went from your original question to a vector of numbers. Anyway, if I understood correctly: %example data match...

7 years ago | 1

| accepted

Load more