377 total contributions since 2012

Answered

Why does my plot not display when I use a nested loop?

If you want to get this as line plot, you'll need all values of a and c to be in one array each. If the example you have posted ...

Why does my plot not display when I use a nested loop?

If you want to get this as line plot, you'll need all values of a and c to be in one array each. If the example you have posted ...

약 4년 ago | 0

| accepted

Answered

Please help me how to describe a matrix in terms of smaller matrices.

Is it sure they overlap by one line/column? Then it's just A=[A11 A12(:,2:end);A21(2:end,:) A22(2:end,2:end)];

Please help me how to describe a matrix in terms of smaller matrices.

Is it sure they overlap by one line/column? Then it's just A=[A11 A12(:,2:end);A21(2:end,:) A22(2:end,2:end)];

약 4년 ago | 0

| accepted

Answered

Selecting particular data range from matrix

No data is available and the code is not formatted. Please use the {}Code button for proper code formatting and please not only ...

Selecting particular data range from matrix

No data is available and the code is not formatted. Please use the {}Code button for proper code formatting and please not only ...

4년 이상 ago | 0

Answered

grouping values of 3 columns

Not clear what you mean: Do you want a numeric array or a string? If it's numeric, there's no 020 but only 20. If you want strin...

grouping values of 3 columns

Not clear what you mean: Do you want a numeric array or a string? If it's numeric, there's no 020 but only 20. If you want strin...

4년 이상 ago | 0

| accepted

Answered

Counting number of 1's in different bins

histc can have two output parameters: [temp,ind] = histc(A,[100,200,300,400]); Use the second one as input parameter for...

Counting number of 1's in different bins

histc can have two output parameters: [temp,ind] = histc(A,[100,200,300,400]); Use the second one as input parameter for...

4년 이상 ago | 2

Answered

why do we need the analytic gradient in fmincon?

The algorithm applied (by default interior-point-algorithm, find details <http://www.mathworks.com/help/optim/ug/constrained-non...

why do we need the analytic gradient in fmincon?

The algorithm applied (by default interior-point-algorithm, find details <http://www.mathworks.com/help/optim/ug/constrained-non...

4년 이상 ago | 0

| accepted

Answered

Compare the contents to 2 subsystems within Simulink

I don't know what you mean with "subsystem", but if you have two variables with any kind of data (no matter if it's a struct or ...

Compare the contents to 2 subsystems within Simulink

I don't know what you mean with "subsystem", but if you have two variables with any kind of data (no matter if it's a struct or ...

4년 이상 ago | 0

Answered

20 value from a normal distribution..

First, make sure that there are enough numbers available (with the values you use, this might not be a problem): lo=8;hi=3...

20 value from a normal distribution..

First, make sure that there are enough numbers available (with the values you use, this might not be a problem): lo=8;hi=3...

4년 이상 ago | 0

| accepted

Answered

How to turn data from text file into cell array?

What is rows 2-18? Under the assumption that we can ignore them, just use textscan and take them as headerlines: >> fid=fo...

How to turn data from text file into cell array?

What is rows 2-18? Under the assumption that we can ignore them, just use textscan and take them as headerlines: >> fid=fo...

4년 이상 ago | 0

| accepted

Answered

How can I save, close, and then reopen a Matlab file later so that I can resume at the same workspace when I closed the file?

What do you mean with closing the file? You can save the workspace with mat-files. save('matfile.mat') will save the current...

How can I save, close, and then reopen a Matlab file later so that I can resume at the same workspace when I closed the file?

What do you mean with closing the file? You can save the workspace with mat-files. save('matfile.mat') will save the current...

4년 이상 ago | 0

Answered

MATRICES with customized sum for rows and columns

To get mat1, you can use the magic function: >> mat1=magic(4) mat1 = 16 2 3 13 5 1...

MATRICES with customized sum for rows and columns

To get mat1, you can use the magic function: >> mat1=magic(4) mat1 = 16 2 3 13 5 1...

4년 이상 ago | 0

| accepted

Answered

Find the total number of values between alimits

you were close: >> A= [1,2,3,4,5,6,7,8,9,10,11]; >> sum(A>3 & A<10) ans = 6

Find the total number of values between alimits

you were close: >> A= [1,2,3,4,5,6,7,8,9,10,11]; >> sum(A>3 & A<10) ans = 6

4년 이상 ago | 1

| accepted

Answered

Concatenation of multiple variables into one variable

Assuming that the mat file contains _only_ these variables: data=cell2mat(struct2cell(load('filename.mat'))); meanvals=...

Concatenation of multiple variables into one variable

Assuming that the mat file contains _only_ these variables: data=cell2mat(struct2cell(load('filename.mat'))); meanvals=...

4년 이상 ago | 0

Answered

how to eliminate the blank between subplot ?

Use the set command and the position property. Here is one example with zero spacing between the 2x2 axes and a 0.1 frame around...

how to eliminate the blank between subplot ?

Use the set command and the position property. Here is one example with zero spacing between the 2x2 axes and a 0.1 frame around...

4년 이상 ago | 0

| accepted

Answered

Renaming an array in a script

I see two options. 1) You _know_ the names in advance (because they are all the same for every Excel file you open). Then, y...

Renaming an array in a script

I see two options. 1) You _know_ the names in advance (because they are all the same for every Excel file you open). Then, y...

4년 이상 ago | 1

Answered

simple question function file syntax

You can use anonymous functions: f=@(x) sqrt((9.81*x)/0.25).*tanh(sqrt((9.81*0.25)./x)*4); Then, f(xr) will return the ...

simple question function file syntax

You can use anonymous functions: f=@(x) sqrt((9.81*x)/0.25).*tanh(sqrt((9.81*0.25)./x)*4); Then, f(xr) will return the ...

4년 이상 ago | 0

| accepted

Answered

Using ordered list for plotting charts

Your question is a bit unclear. Do you struggle with loading the data, with sorting the data or with plotting the data? Plus, wh...

Using ordered list for plotting charts

Your question is a bit unclear. Do you struggle with loading the data, with sorting the data or with plotting the data? Plus, wh...

4년 이상 ago | 0

Answered

How to evaluate mean for column

You can use arrayfun: dx=zeros(100,1); dx(randi(100,10,1))=1; B=cumsum(dx); A=(1:100).^2; meanvals=arrayfun(@(x) me...

How to evaluate mean for column

You can use arrayfun: dx=zeros(100,1); dx(randi(100,10,1))=1; B=cumsum(dx); A=(1:100).^2; meanvals=arrayfun(@(x) me...

4년 이상 ago | 0

| accepted

Answered

sum of rand matrix equal to zero

What kind of random distribution do you want? Here I use normal distribution, for other distributions just replace randn by the ...

sum of rand matrix equal to zero

What kind of random distribution do you want? Here I use normal distribution, for other distributions just replace randn by the ...

4년 이상 ago | 0

Answered

how to remove repeated Xtick values

I don't like the idea of labeling x=1 with "1/24" too much, but if you want to do this: You also need to set the xtick property:...

how to remove repeated Xtick values

I don't like the idea of labeling x=1 with "1/24" too much, but if you want to do this: You also need to set the xtick property:...

4년 이상 ago | 1

| accepted

Answered

How to set LineStyle for matrix plotting?

It's not very intuitive, but that's the point (from <http://www.mathworks.com/help/matlab/creating_plots/defining-the-color-of-l...

How to set LineStyle for matrix plotting?

It's not very intuitive, but that's the point (from <http://www.mathworks.com/help/matlab/creating_plots/defining-the-color-of-l...

4년 이상 ago | 0

| accepted

Answered

Good way to import data file

If the format doesn't change through the file (such that after 10 s, suddenly also data about whatever appears), you can simply ...

Good way to import data file

If the format doesn't change through the file (such that after 10 s, suddenly also data about whatever appears), you can simply ...

4년 이상 ago | 1

| accepted

Answered

Changing a row vector into a logical vector

If s is your stimulus array and t your time array and, let's say a value of s larger than 0.5 indicates this stimulus: s_l...

Changing a row vector into a logical vector

If s is your stimulus array and t your time array and, let's say a value of s larger than 0.5 indicates this stimulus: s_l...

4년 이상 ago | 1

Answered

change x axis, i have a plot of data from a headset. then i have 5 lines from a game, so i want 0-time from start(green) line till the end(red line), is it possible?

It's not quite clear what you want. 1) You want the x-axis to only go from the green line to the red line: xlim(Start,...

change x axis, i have a plot of data from a headset. then i have 5 lines from a game, so i want 0-time from start(green) line till the end(red line), is it possible?

It's not quite clear what you want. 1) You want the x-axis to only go from the green line to the red line: xlim(Start,...

4년 이상 ago | 0

Answered

Cut around the center of a matrix

If c indicates the range you want to remove and would be 3 in your example, just use B=A((end-c)/2+1:(end+c)/2,(end-c)/2+1...

Cut around the center of a matrix

If c indicates the range you want to remove and would be 3 in your example, just use B=A((end-c)/2+1:(end+c)/2,(end-c)/2+1...

4년 이상 ago | 0

Answered

matrix loop how to extract data

What do you mean with "extract data"? You mean, instead of writing those 5 lines P1R=mean(P1); and so on, you want to do in a lo...

matrix loop how to extract data

What do you mean with "extract data"? You mean, instead of writing those 5 lines P1R=mean(P1); and so on, you want to do in a lo...

4년 이상 ago | 0

Answered

Help with function main and writing cross product function

You have to decide if you want to name the output argument "w" or "result". If you change your second last line to w=[i j ...

Help with function main and writing cross product function

You have to decide if you want to name the output argument "w" or "result". If you change your second last line to w=[i j ...

4년 이상 ago | 0

| accepted

Answered

splitting large cell array into smaller cell arrays

If you really want to have the inside to be a struct, you can go with c=cellfun(@(x) cell2struct(mat2cell(x,3*ones(7,1),20...

splitting large cell array into smaller cell arrays

If you really want to have the inside to be a struct, you can go with c=cellfun(@(x) cell2struct(mat2cell(x,3*ones(7,1),20...

4년 이상 ago | 0

| accepted

Answered

how to access cell array data with single for loop

You mean like for cnt=1:length(A) C=A{cnt}; D=B{cnt}; end Actually, there is no need for cell arrays here. In c...

how to access cell array data with single for loop

You mean like for cnt=1:length(A) C=A{cnt}; D=B{cnt}; end Actually, there is no need for cell arrays here. In c...

4년 이상 ago | 0