Answered
How to read specific fields from multiple structure arrays in MATLAB?
idx=cellfun(@(x,y) x==2 |y==0.8,{Flight1.testpoint},{Flight1.match}) %idx is the index that fit your conditions

14 years ago | 0

| accepted

Answered
convert image to strings
im=iread('yourimage') out=num2str(im)

14 years ago | 1

| accepted

Answered
How can you import a constant (1x1) matrix into Simulink, from Matlab workspace?
Have you tried a <http://www.mathworks.com/help/simulink/slref/constant.html constant block> from Simulink/Sources?

14 years ago | 0

| accepted

Answered
How can I store, in a specific way, my data within a cell array?
Look at this example A=cell(10,8) b=num2cell(rand(4,5)) A(1:size(b,1),1:size(b,2))=b

14 years ago | 0

Answered
"print" saves image with tiny title/xlabel
Use set(gcf, 'PaperUnits', 'centimeters','PaperPosition', [0 0 6 3]); Choose your dimension, before saving the figure

14 years ago | 0

Answered
How to mutate '0' to '1' and '1' to '0' in GA code Using MATLAB?
A=['010101010011000011011101100111' '010110010011000011011101100110' '010101010110000011011101100110' '01111101001100001101...

14 years ago | 0

Answered
Removing error from a code...............
Check if the function *l1eq_pd* is in your working folder, the same folder where you have your main code

14 years ago | 1

| accepted

Answered
How can I set automatically the textarrow position on a graph?
annotation('textarrow',[x0,x1],[y0,y1],'String',yourtext);

14 years ago | 0

Answered
matlab code for taking very less sample
If you have a Signal Processing toolbox, you can use *downsample* function

14 years ago | 1

Answered
datestring in uitable problem with cells array
Use dates=cellstr(datestr(data_between_dates(1:2,1),'dd-mm-yyyy')) data=num2cell(data_between_dates(1:2,2)) c=[dates da...

14 years ago | 1

| accepted

Answered
matlab datenum to excel datetime
That mean you are exporting your data from Matlab to Excell, then you can set the format you need in Matlab and export it to Exc...

14 years ago | 1

Answered
Controlled sourse by a control signal
You can use a <http://www.mathworks.com/help/simulink/slref/switch.html switch block>

14 years ago | 0

| accepted

Answered
Recursive Function with two Base Cases
It's not *elseif* use *else* Also you are using a function with input argument N, why in your function you added: N = i...

14 years ago | 0

Answered
multiple plots on a subplot
Use *hold on* t=0:0.1:10; y1=sin(t) y2=cos(t) subplot(2,1,1) plot(t,y1) hold on plot(t,y2,'r')

14 years ago | 3

| accepted

Answered
structure containing empty string arrays
You can use x=struct('a',{''},'b',{''}); *Edit* n=10; v=arrayfun(@(x) {''},1:n,'un',0) a=struct('a',v,'b',v)

14 years ago | 0

Answered
cellfun(@isnan) and erasing NaN
Use cellfun(@isnan,a,'UniformOutput',false) Which means xlswrite('newfile.xls', a(~any(cellfun(@isnan,a,'UniformOut...

14 years ago | 2

Answered
Computing a time it takes for matlab to complete a nest of for loops?
Use tic toc tic for i = 1:100 for j = 1:100 for k = 1:100 end end end tim=toc

14 years ago | 1

Answered
how to create symbolic vector?
v=['[' sprintf('a%d,',1:10)]; v(end)=']' a=sym(v)

14 years ago | 0

| accepted

Submitted


Get harmoniques of a real signal
Given the signal x(t), the function find a0, ak, bk the amplitudes of cos and sin waves.

14 years ago | 1784 downloads |

5.0 / 5
Thumbnail

Answered
Concatenate String and Numbers Horizontally
You should use a cell array out=[cellstr(a) num2cell(b) num2cell(c)]

14 years ago | 3

| accepted

Answered
How to pick out rows from a 2D cell array based on several criteria
in={'a' [1] [2] [3] [100];'b' [11] [12] [13] [1000]} x=1;y=2;z=3; % Your data %-----------------------The code-------------...

14 years ago | 0

Answered
using specific columns from a constant
In your *constant* block set the value to matrix(:,1:9) Use another *constant* block for X

14 years ago | 1

| accepted

Answered
sort and sortrow differences
A=magic(4); sort(A,1) % sorts the columns of A independently sort(A,2) % sorts the rows of A independently sortrows(A,2) %...

14 years ago | 0

Answered
average of the graphs
data=[1 10 15 16 12 11 2 20 23 19 16 21 3 30 32 28 25 33 4 40 38 44 45 39] data_mean=mean(...

14 years ago | 0

Answered
how to create a matrix from existing matrix
A=[0.25 0.2 .15 .2 .1] a=cell2mat(arrayfun(@(x) x+A(x)-1:A(x):x,1:numel(A),'un', 0 ))'

14 years ago | 1

Answered
a simple substitution problem !
*Edit* u = [ 10 10 ; 5 5 ]; y=u(:); n=size(u,1); y((1:n).^2)=0.5; out=reshape(y,n,n)

14 years ago | 0

Answered
Is there any way to send sevarla variables from simulink to a single workspace variable?
Pass your signals through a *Mux* block, then use a *to workspace* block

14 years ago | 0

| accepted

Answered
How to add columns with month number and day
a=datenum(2000,1,(1:7*365+122)) v=datevec(datenum(a)) col_month=v(:,2) col_day=v(:,3) If you want your date in other f...

14 years ago | 1

| accepted

Answered
How to delete specified curved in a figure using a handle?
cla(gca) % or if you have two plots in the same figure t = 0:0.1:2*pi; y = sin(t); y1=cos(t); h1=plot(t,y); hold ...

14 years ago | 0

Load more