Risposto
Creating a logical array within a loop
In a loop the indexing works just as normal. I also made some other changes to your code. temp_array=zeros(____,numel(Behaviour...

circa 6 anni fa | 0

| accettato

Risposto
How to express extremes??
It is fine to post questions related to GNU Octave, but you need to make sure that your issue is reproducible in Matlab. It is ...

circa 6 anni fa | 0

Risposto
How to fit a common linear trend observed across multiple sensors?
You can just replicate the x-values and linearize all your data: %% Make some fake noisy measurements timeStep = 1:100; % Time...

circa 6 anni fa | 1

| accettato

Risposto
Applying function on few elements each time, using a for loop
If you don't mean what Ameer posted, then you could mean a sliding window maximum. You could write it yourself with a loop, but ...

circa 6 anni fa | 0

Risposto
I would like to create a matrix using a for loop
If you had used the debugging tools, you would have noticed that your variables are reset every iteration. You need to move a...

circa 6 anni fa | 0

| accettato

Risposto
find arrays that are consecutively equal
I adapted your input data a bit. The code below should be easy to modify for your goals. W= [ 1 4 3 6 7 4 2 6 0 0 0 0 25 6 15 ...

circa 6 anni fa | 0

| accettato

Risposto
How do I plot both of these different sized arrays on the same plot?
Assuming your x-axis is time and Tgb and Tpp encode that: subplot(2,1,1) plot (Tgb,Ygb) hold on plot (Tpp,Ypp) hold off ...

circa 6 anni fa | 0

| accettato

Risposto
How do I create a row vector 'r' that takes a value depending on whether 'nodelocation' is above or below 'd'?
Your if statement does not automagically become a for-loop. You need to do the array operation: data=rand(100,1);%some random d...

circa 6 anni fa | 1

| accettato

Risposto
Making a nice and small 'Loding Data' Script
The code below should read your file and convert it to a double array. file_contents=fileread('SBA15_Data.txt.txt'); file_cont...

circa 6 anni fa | 1

| accettato

Risposto
How do I use inputdlg in a for loop to return a numerical array?
A few good practice tips: avoid i and j as variable names to avoid confusion with sqrt(-1), avoid l (lowercase L) as well to av...

circa 6 anni fa | 0

| accettato

Risposto
If and continue conditions
If you use the debugger to step through your code line by line, you will have notice that your condition works (although I would...

circa 6 anni fa | 0

| accettato

Risposto
Write a code to start array only when condition is true
Your code is very confusing, so I am going to ignore it. Just one tip: you need to make sure your condition is a scalar, and you...

circa 6 anni fa | 0

| accettato

Risposto
Recursive Function and increment global/persistant variable
You could do this with a recursive function, but it is a better idea to use a for-loop: %generate some random data sz=[5 30]; ...

circa 6 anni fa | 0

Risposto
Timing button presses code
You need to review your logic. What conditions are true when a button is pressed for the first time? And how do those conditions...

circa 6 anni fa | 0

Risposto
Perform rssq on each row
All relevant functions support array operations and sum allows you to specify the dimension to operate along. X=rand(100,5000);...

circa 6 anni fa | 0

| accettato

Risposto
Delete certain entries in a 3D matrix
I'm assuming the last page of your example is incorrect. clear A A(:,:,1) = [1 2 3; 4 5 6; 7 8 9];...

circa 6 anni fa | 1

Risposto
What is this error in my iterative program?
Your code has some minor issues. I fixed some of them below. I also added a block of code where you need to add either an error ...

circa 6 anni fa | 0

| accettato

Risposto
where is the origin of the coordinate system when I use the stlread function to get the coordinates of an stl file?
In general an stl reader function will use the origin that is encoded in the file itself. If you open the file file with a plain...

circa 6 anni fa | 1

| accettato

Risposto
Alternative for eval of dynamic variables
If you use a cell array you can store everything in a single array even if the size are different. Because you can index into th...

circa 6 anni fa | 1

| accettato

Risposto
figure adding plot to named figures?
You can modify the NextPlot property of your axes objects. You can do this by modifying the property, or by using hold on. h=st...

oltre 6 anni fa | 1

| accettato

Risposto
How to pass the same function to different columns?
You need to specify the target axes, otherwise the function will use gca for each call, so that will be the same axes. figure(1...

oltre 6 anni fa | 0

| accettato

Risposto
Reading Workspace variable into csv file
The most important thing to do first is to reshape the data to a 2D array. Then we can use the writematrix function as normal. ...

oltre 6 anni fa | 1

| accettato

Risposto
How to concatenate different rows
You can't concatenate files. (Technically you can, but showing how you could do it will not be helpful for you) What you need t...

oltre 6 anni fa | 1

Risposto
I can't get to diplay values in a edit box. HELP!!!
It looks like you are trying to set a numeric value as the String property. You will first have to convert your symbolic values ...

oltre 6 anni fa | 0

| accettato

Risposto
Creating a Path to a sub folder
As mentioned in the documentation for uigetfile you can capture the path of the selected files as the second output.

oltre 6 anni fa | 0

Risposto
How to read .params file via matlab?
Reading text files to Matlab variables is one of the most commons tasks. One of the many, many functions is my readfile function...

oltre 6 anni fa | 0

| accettato

Risposto
Global variables when doing Matlab array job in a cluster
I don't have a direct link to the doc, but I'll take Walter's word for it: "The initial value of the global variables will not ...

oltre 6 anni fa | 0

| accettato

Risposto
Outputs for smoothdata function
As you can read in the documention for the smoothdata function the first output is the smoothed data. It will not actually produ...

oltre 6 anni fa | 0

Risposto
splitapply with own created function
You can probably get around this by wrapping your function in an anonymous function: fun=@(input1)maxperinterval(input1,s); ...

oltre 6 anni fa | 0

| accettato

Risposto
can a struct function access struct elements ?
When defining an anonymous function it will have access to all the variables in scope. It doesn't matter how you store that anon...

oltre 6 anni fa | 0

| accettato

Carica altro