Respondida
weird situation while using sprintf to generate a long string with 0 (probability of 0.5) and 1 (probability of 0.5) with space in between two adjacent characters
Since this was the solution to the problem, I'll move my comment to the answer section. Your code creates an array of 0 or 1...

casi 7 años hace | 1

| aceptada

Respondida
How to remove zeros from an array without using nonzeros command
If you insist on a loop: loop backwards through your array to account for removed elements. x=[1 2 2 0 3 1 3 0 0]; for n...

casi 7 años hace | 0

| aceptada

Respondida
How to find max of an array avoiding the inf?
max(data(~isinf(data))

casi 7 años hace | 7

| aceptada

Respondida
How to create 2d plots
This code below shows that a change in the algorithm can have more speed increase than tweaking parameters. If you update the pr...

casi 7 años hace | 2

Respondida
Help with unification cycle
x(x==1)=y;

casi 7 años hace | 0

| aceptada

Respondida
How to change inputdlg's editbox into a popup menu?
I'll be honest, it took me about 15 minutes, but this should to something similar to what you describe: selection=doubleDropMen...

casi 7 años hace | 1

| aceptada

Respondida
Get data within circular ROI
This code also works for non-integer positions and radii. data=rand(200,200); %generate example data radius = 20; %circle radi...

casi 7 años hace | 0

| aceptada

Respondida
How can I fit my data by using lsqcurvefit?
I didn't exactly understand how you went from your function to the code, so I re-implemented it. Apparently there is a functiona...

casi 7 años hace | 1

| aceptada

Respondida
How to get the "zero/blank" element of a given variable?
You can abuse repmat for this: a=uint8(8); repmat(a,0,0) b='foo_bar'; repmat(b,0,0) Edit: On second read, you might actual...

casi 7 años hace | 0

| aceptada

Respondida
save fig "argument must be a fig file" error
I would suggest using sprintf to generate the file name. Check if the precision parameters are set to what you mean. I assumed n...

casi 7 años hace | 0

Respondida
Hello. I tried to create a new script but this error occur
There is a lot wrong with this code: The layout: select the code and click the smart indent button. That will make sure the ind...

casi 7 años hace | 1

Respondida
Mean based on positive and negative values of a field
Logical indexing: L=[S.f2]>0; pos_mean=mean([S( L).f1]); neg_mean=mean([S(~L).f1]);

casi 7 años hace | 1

| aceptada

Respondida
matrix to cell convert?
I'm going to assume you have 256x256 separated into 64x64 blocks and you want to redistribute to 4x4 blocks. %create some data ...

casi 7 años hace | 1

| aceptada

Respondida
selecting different criteria for logicals
L=data(:,1)==2 & data(:,2)==3;

casi 7 años hace | 0

| aceptada

Respondida
I need a matlab code for normalizing this chart between 0 and 255
A first approximation could be something like this: %generate some data t=1:200; data=80+70*sin(t/4)+rand(size(t))*5; data...

casi 7 años hace | 0

Respondida
How to sort matrix based on another matrix?
Assuming you made a small typo in your B_out: A=[3,2,1;8,3,1;6,4,2]; B=[5,9,2;9,2,1;8,7,4]; for row=1:size(A,1) [A(row...

casi 7 años hace | 0

Respondida
Mat Lab Loop question It's not working properly. (Loops)
Neither, you need to tackle this problem step by step. You need to create a random vector of integers. The second example doesn...

casi 7 años hace | 0

| aceptada

Respondida
Help for GUI initializing Problem
You can't start a GUIDE-created GUI by opening the fig file. You need to run the function (so the m file). <personal opinion> D...

casi 7 años hace | 0

| aceptada

Respondida
how to reduce the use of repeated for loops as i explained below???
Use a temporary variable to adapt your range. The code below show one such approach. %intitialize for testing no_gridsx=10; n...

casi 7 años hace | 0

| aceptada

Respondida
Can I write a script that keeps rows that are within 5% and 10 cells above and below a specific cell?
If you have a cell array you should convert it to a numeric type (e.g. a double). You can find outliers by using the movmean ...

casi 7 años hace | 0

| aceptada

Respondida
Propety of variable in one line matlab
Why do you need one line? It is generally less readable if you try to write it like that. But if you insist: the <https://www...

casi 7 años hace | 0

Respondida
plotting a multivariable function by colors
You can use the surf function (and set the view so you look from above), or use ind2rgb to apply a colormap. Edit: The code be...

casi 7 años hace | 0

Respondida
How Read text file as array form , Please
The code below should get you most of the way there. The idea is to parse each element and then remove it from the variable, so ...

casi 7 años hace | 1

Respondida
Automation/Rerun the program for different inputs automatically.
This is trivial if you put your code in a function: function price=getPrice(Rows,Columns) price=sin(Rows)*exp(Columns);%whatev...

casi 7 años hace | 0

Respondida
How to use Prod function with cell arrays
It is always good to consider if the task you want to accomplish asks for a different data design. I think it is much easier to ...

casi 7 años hace | 0

Respondida
pairs of consecutive numbers
I have expanded your example array a bit to more clearly show the indeded effect. I have replicated the effect of your code, ple...

casi 7 años hace | 1

Respondida
How to remove/rename part of a file name in a loop?
Something like this should work. Adapt as needed. list=dir('Hoverdofeightnosleevetriggered*.*'); for n=1:numel(list) old=...

casi 7 años hace | 1

| aceptada

Respondida
Skeletonizing a 3d voxel data
I generated some random points to show how your code should work. The attached function is an edited version of a FEX entry. Thi...

casi 7 años hace | 0

| aceptada

Respondida
random order of elements in array meeting some conditions
I'm not aware of any method that can do what you want. In the mean time, you can use the code below to improve the efficiency of...

casi 7 años hace | 0

Respondida
How to save nested cells in mat file
The code below is probably what you need (or close to it). If letters are used that are not in the letterlist, then an error wil...

casi 7 años hace | 0

| aceptada

Cargar más