Answered
how to convert matrix A 1 x 200 into 100 x2
*Edit* A=[1 2 3 4 5 6] out=reshape(A,2,[])' %or out=[A(1:2:end)' A(2:2:end)']

13 years ago | 1

| accepted

Answered
Index exceeds matrix dimensions
You should look at the sizes of r and z, and check if their indices do not exceed those sizes

13 years ago | 0

Answered
How can I save the x and y values obtained from ginput through a for loop?
data(k,:)=ginput(1); x=data(k,1) y=data(k,2)

13 years ago | 0

Answered
Use of CELLFUN instead of FOR loop
A=num2cell(rand(21,40)) % Example out=arrayfun(@(x) cat(2,A{:,x}),1:size(A,2),'un',0)

13 years ago | 0

| accepted

Answered
How can i create a symbolic function it depends on other two functions?
syms x y; f=3*x; g=2*y; t=f*g+3*g+f/g;

13 years ago | 0

| accepted

Answered
Use of CELLFUN instead of FOR loop
for n = 1:40 merge = cat(2,A{:,n}) end is the same then merge = cat(2,A{:,40})

13 years ago | 1

Answered
Measuring Delay - Matlab/SImulink
Pass y through a <http://www.mathworks.com/help/simulink/slref/unitdelay.html unit delay> block

13 years ago | 0

| accepted

Answered
Callback function in guide
The second function should be function newshapecreated(hObject, eventdata, handles) shapes=handles.shapes

13 years ago | 0

Answered
Use of Evalin in matlab
evalin(symengine,sprintf('orthpoly::legendre(%d, cos(thea))',ii),thea,0,pi),phia,0,2*pi)

13 years ago | 0

Answered
Complex transfer function, 's' to 'jw' conversion
If you have the transfer function G, you can get the numerator and denominator by using getdata function, then use this code ...

13 years ago | 0

Answered
How can I use discrete time data instead of functions for solving equations using ODE45?
*Edit* t1 = linspace(0,10,25); % Generate t for y1 y1 = rand(1,25); % Generate y1, in your case sin(t1) tspan=[0 10]; y0...

13 years ago | 1

Answered
Term frequency for strings with a given vector
A = {'DI','FI','IM','MI'} B = {'MI','IM','MI'} cellfun(@(x) sum(ismember(B,x)),A)

13 years ago | 0

Answered
Reading cells extension wise in matlab.
A={'q.txt';'w.txt';'e.txt';'r.exe';'t.exe';'k.xls';'m.xls'} % xls files out_xls=A(cellfun(@(x) ~isempty(strfind(x,'.xls')),A...

13 years ago | 1

| accepted

Answered
How can I create and save a variable that contains filename ?
name='a1' save('yourmatfile',name) But this is not a good idea, if you explain what you want to achieve, maybe there a...

13 years ago | 0

| accepted

Answered
Load function,getting started
Look at this example % How to write a .dat file A=[1 2 3;4 5 6] fid=fopen('file1.dat','w') fwrite(fid, A) fclose(fid) ...

13 years ago | 0

| accepted

Answered
Why does the code give different results with different versions of MATLAB?
y=[0;24.0/L]; How Matlab will calculate 24.0/L if the value of L is unknown? You should give a value to L, for example ...

13 years ago | 0

Answered
How can i leave the vector result?
If you need dB(2)=7 write dB(2)=7 If not provide more information

13 years ago | 0

Answered
How to export simulink data to workspace during simulation?
There are several ways to export your data to workspace # you can use a <http://www.mathworks.com/help/simulink/slref/scope.h...

13 years ago | 2

| accepted

Answered
How to calculate both length and indices of a series of a certain value in a vector
Run this and check the results Targets=[30 0 20 0 1]' a=Targets==0 b=[false;a;false] t = diff(b)

13 years ago | 1

Answered
Sign switching in a sequence
ii=histc(sign(diff(A)),[-1;0;1]) %ii(1) correspond to switch high-low %ii(2) no switch %ii(3) ...

13 years ago | 0

Answered
How do you create a push button that saves data from a GUI?
res=get(handles.uitable1,'data') save filename res

13 years ago | 0

| accepted

Answered
create a variable to store sets
S{1,1}='a', S{1,2}='b' S{1,3}={1,2,3,4,5} S{2,1}='b', S{2,2}='c' S{2,3}={3,4,5}

13 years ago | 0

Answered
How to quickly extract a unique list of rows from a cell array?
[idx,idx]=unique(cell2mat([cellfun(@num2str,A(:,1:3),'un',0) A(:,4:5)]),'rows') out=A(idx,:)

13 years ago | 0

Answered
User controlled axis limits
xl=str2double(get(handles.axes1,'xlim')); xl2=xl(2) xlim(handles.axes1,[user_entry xl2]);

13 years ago | 1

| accepted

Answered
How can i choose one result of numerical result?
max(blnOut)

13 years ago | 0

| accepted

Answered
Sorting and collecting data from arrays
out=arrayfun(@(x) A(find(A(:,1)==x),:),unique(A(:,1)),'un',0) % the result out{1} out{2} out{3}

13 years ago | 0

Answered
how to combine contents from multiple cells into one cell or datevector?
x={12,10,1,12,30;13,5,24,13,30} x=cell2mat(x) x=[x zeros(size(x,1),1)] y=datenum(x)

13 years ago | 0

| accepted

Answered
tell me how to calculate histc(x,y)
<http://www.mathworks.com/help/matlab/ref/histc.html> doc histc

13 years ago | 0

Answered
plotting in different colors with different linestyles or markers
Look at this link <http://www.mathworks.com/help/matlab/creating_plots/defining-the-color-of-lines-for-plotting.html>

13 years ago | 0

Answered
I wanna stop iteration when two matrixes difference approach zero.
tol=0.001 while sum(abs(A-B))>tol % do end

13 years ago | 0

| accepted

Load more