Respondida
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...

casi 7 años hace | 1

| aceptada

Respondida
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...

casi 7 años hace | 0

| aceptada

Respondida
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...

casi 7 años hace | 0

| aceptada

Respondida
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...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 0

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

casi 7 años hace | 1

Respondida
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...

casi 7 años hace | 1

Respondida
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(...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 0

| aceptada

Respondida
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)...

casi 7 años hace | 0

| aceptada

Respondida
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...

casi 7 años hace | 0

| aceptada

Respondida
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 ..."...

casi 7 años hace | 1

| aceptada

Respondida
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...

casi 7 años hace | 2

| aceptada

Respondida
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...

casi 7 años hace | 1

Respondida
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)

casi 7 años hace | 1

| aceptada

Respondida
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...

casi 7 años hace | 1

| aceptada

Respondida
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...

casi 7 años hace | 2

| aceptada

Respondida
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...

casi 7 años hace | 1

| aceptada

Respondida
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])...

casi 7 años hace | 0

| aceptada

Respondida
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...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 0

Respondida
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}...

casi 7 años hace | 1

| aceptada

Respondida
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 =. ...

casi 7 años hace | 0

| aceptada

Respondida
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) ...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 0

Respondida
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 ...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 1

| aceptada

Respondida
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...

casi 7 años hace | 2

Respondida
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...

casi 7 años hace | 1

| aceptada

Cargar más