Réponse apportée
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...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How to find max of an array avoiding the inf?
max(data(~isinf(data))

presque 7 ans il y a | 7

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 2

Réponse apportée
Help with unification cycle
x(x==1)=y;

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

Réponse apportée
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...

presque 7 ans il y a | 1

Réponse apportée
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]);

presque 7 ans il y a | 1

| A accepté

Réponse apportée
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 ...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
selecting different criteria for logicals
L=data(:,1)==2 & data(:,2)==3;

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

Réponse apportée
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...

presque 7 ans il y a | 0

Réponse apportée
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...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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 ...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

Réponse apportée
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...

presque 7 ans il y a | 0

Réponse apportée
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 ...

presque 7 ans il y a | 1

Réponse apportée
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...

presque 7 ans il y a | 0

Réponse apportée
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 ...

presque 7 ans il y a | 0

Réponse apportée
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...

presque 7 ans il y a | 1

Réponse apportée
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=...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 7 ans il y a | 0

Réponse apportée
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...

presque 7 ans il y a | 0

| A accepté

Charger plus