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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

Beantwortet
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]; ...

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

Beantwortet
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);...

mehr als 6 Jahre vor | 0

| akzeptiert

Beantwortet
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];...

mehr als 6 Jahre vor | 1

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 1

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

| akzeptiert

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

mehr als 6 Jahre vor | 0

| akzeptiert

Mehr laden