Answered
Calling matrices automatically with matlab
elem1 = [1,1] elem2 = [2,2] elem3 = [3,3] for k=1:3 eval(sprintf('a=elem%d',k)); A(k,1:n)=a end

13 years ago | 0

Answered
Ho to delete the image from the axes?
Try cla(handles.axes1)

13 years ago | 0

Answered
How to insert a matrix into another matrix
A = 1:38 B = [22 22 22] n = 8; m=numel(A); idx2=unique([n:n:m m]) idx1=[1 idx2(1:end-1)+1] out=[B cell2mat(arrayfun(@(ii...

13 years ago | 0

Answered
How to manipulate the index of the for loop
for i1 = 1:10 if i1==4 i1 = 6; end end when |i1==4| you set |i1| to |6| ; the next iteration |i1| will be ...

13 years ago | 0

| accepted

Answered
text matrix to scaler matrix
v= {'10 11 12 13 ';'1 2 3 0'} a=cellfun(@(x) cellfun(@str2double,regexp(x,'\d+','match')),v,'un',0); out=cell2mat(a)

13 years ago | 0

Answered
How to insert a string into a sprint?
name = input ('Enter the name of the voice command','s'); file = sprintf('%s.wav',name);

13 years ago | 0

| accepted

Answered
Accessing variables from workspace into user-created function block in Simulink
You can declare your variable as persistent function y=fcn(u) persistent v if isempty(v) v=your_constant end v=v...

13 years ago | 1

| accepted

Answered
Help me about plot y = 1/x
x=0:0.1:1; y=1./x; plot(x,y)

13 years ago | 6

| accepted

Answered
how to find maximum values of two numbers present in a structure
data=struct('a',{8 5}) % Example out=max([data.a])

13 years ago | 0

| accepted

Answered
get the values from user via text field
You can use an edit box and pushbutton with callback: y=str2double(get(handles.edit1,'string'))

13 years ago | 0

| accepted

Answered
Plot points with different symbols
a=dlmread('file.txt') x=a(:,1) y=a(:,2); ii=a(:,3); idx=ii==1 scatter(x(idx),y(idx),'*') hold on scatter(x(~idx),y(~idx...

13 years ago | 0

| accepted

Answered
how to manipulate this matrix?(need help pls)
A=[1;11;111;2;22;222;3;33;333;4;44;444;5;55;555;6;66;666] x=A(1:3:end) for k=4:numel(x) out(k)=mean(x(k-3:k-1)) end ...

13 years ago | 0

Answered
sorting without moving NaNs
A=[20 10 NaN 66 NaN 12] idx=~isnan(A); B=sort(A,'descend'); B(isnan(B))=[]; A(idx)=B

13 years ago | 1

Answered
I have a question about plot. Plesase help me.
s=get(gca,'ylim') hold on; plot([a a],s)

13 years ago | 1

| accepted

Answered
How do I create such matrix ? (please look at the thread for further details)
A=[1 2 3;4 5 6] B=[11 22 33;44 55 66] C=[111 222 333 ;444 555 666] [n m]=size(A); p=3 % number of variables; A=A'; B=B';...

13 years ago | 0

| accepted

Answered
most frequent value in a 3D matrix other than 0
A=randi([0 4],100,100,20); %Example [freq,number]=max(histc(A(:),1:4))

13 years ago | 1

| accepted

Answered
how do i "re attach" row id column vectors(made up of words) to the numeric value columns, matlab separates my data???
Your data looks like data={'jim01' 4.5 1.5; 'john18' 3.05 5.0 ;'jane43' 7.5 9.0 } scatter(cell2mat(data(:,2)), cell2mat(...

13 years ago | 0

Answered
accessible property for an instance
Why not xlabel('time') And in your code there is a mistake, it's |xlabel| not |xlable| set(get(gca,'xlabel'),'strin...

13 years ago | 0

| accepted

Answered
Differentiate symbolic sum of vectors
y=[1 2 3]; syms m y(m) Error using sym/subsindex Indexing input must be numeric, logical or ':'. That means you...

13 years ago | 0

Answered
how to make a 8x12 matrix into a 96x1 matrix?
A(:) Example A=rand(8,12) B=A(:) %or B=reshape(A,96,1)

13 years ago | 0

Answered
Matrix manipulation such as subtraction
A = [2 3 4 5] ; B = [0 1 2 3 4 5 6 7 8 9]; out=arrayfun(@(x) A-x,B,'un',0); celldisp(out) %or A = [2 3 4 5]; B = [...

13 years ago | 0

| accepted

Answered
Limit the state vector
mod(x,360)

13 years ago | 0

Answered
matrix of numbers and word
Use cell array a={'ab' 'cd' 'ef' 1 2 3 4 55 6} a{2,3}+2

13 years ago | 0

| accepted

Answered
Sort columns by maximum value?
We can make it simple y=x(:,sortrows([max(x);1:size(x,2)]',1)*[0;1])

13 years ago | 1

Answered
cell array conversion to numeric array
If you have v={[1 2 3] , [ 2 5] , 4} w=cell2mat(v) % horizontal concatenation is possible v={[1 2], [3 ; 5]} cell2...

13 years ago | 0

| accepted

Answered
Sort columns by maximum value?
x=[5 -2 3 -10 6 2 0 0 1]; y=x(:,setdiff(accumarray(max(x)',(1:size(x,2))'),0,'stable'))

13 years ago | 0

Answered
Error Conversion to double from sym is not possible
What are values affected to U?

13 years ago | 0

Answered
extracting data from matrix: newbie question
clear distance = [ 0.1 0.332; 0.2 0.678; 0.1 0.876; 0.3 0.765; ...

13 years ago | 0

| accepted

Load more