Answered
Assigning values to a matrix
I assume you have a table, T. T.Height=T.Height>5;

4 years ago | 0

| accepted

Answered
Matrix that changes size
why not enter them all at once? m=input('input x and y coordiants in a matrix, as an example [1 2;3 4;5 6]: ');

4 years ago | 0

Answered
Compact way to write matrices containing indices
[~,idx]=ismember(A,B(:,1)); f=find(idx==0); idx(idx==0)=1; C=B(idx,:); C(f,:)=[A(f),nan(length(f),1)];

4 years ago | 1

Answered
How do create an excel sheet and have data uploaded with each iteration of a loop?
Create the sheet after the completion of your loop. for k=1:100 M(k,:)=%your calculations end writematrix(M,'M.xlsx','Sh...

4 years ago | 0

Answered
Resetting for loop counter
tactarray(:,sum(tactarray<1)>0)=[];

4 years ago | 0

Answered
Include entries after they have been repeated n number of times
A=[1; 2; 2; 2; 2; 3; 3; 3; 3; 3; 4; 4; 4; 4; 5; 5; 6; 6; 6; 7; 7; 7; 7]; a=unique(A); for k=1:length(a) f=find(A==a(k)); ...

4 years ago | 0

| accepted

Answered
loop to repeat steps and plot on same figure
%write simple script to run function Qr = 20.83; B = 13; h = 1.3; E = ?;%unknown X1=(1:.1:10)';%whatever T={60...

4 years ago | 0

| accepted

Answered
how to plot 2 ellipses in one figure using matlabs function plot having been provided with the equations for both?
Much easier to use fimplicit(). eq1=@(x,y)(x+y+2).^2 + (x+3).^2-5; eq2=@(x,y)2*(x+3).^2 + (y/3).^2-4; fimplicit(eq1,[-6,0,-6,...

4 years ago | 0

| accepted

Answered
How to define multiple functions based on random numbers with equal probabilities?
switch randi(3) case 1 y=calculation1(arguments); case 2 y=calculation2(arguments); case 3 ...

4 years ago | 0

| accepted

Answered
MATLAB function and symbolic function give different answers
A = 0.5; B = 2; f = @(a, b, x) (a .* (x - b).^2) .* ((x - b) >= 0); syms a b x; fsym1 = piecewise((x-b)>=0,(a * (x - b)^2),(...

4 years ago | 0

| accepted

Answered
How to plot signal with many legs which has NaN elements
idx=isnan(final); plot(t(~idx),final(~idx));

4 years ago | 0

Answered
Simple vector question.
v=repelem(v2,v1);

4 years ago | 1

| accepted

Answered
Load several text files by a code in several tables / matrix
Use a cell array to load all your tables. n=dir;%assuming you are selected to the desired folder for k=1:length(n) f{k}=r...

4 years ago | 0

Answered
Creating longer linspace array from 2 linspace arrays
eblend=[e1blend1;e1blend2;e1blend3];

4 years ago | 0

| accepted

Answered
Find first common element in 2 vectors
for k=1:length(A) c=intersect(A(1:k),B(1:k)); if ~isempty(c) break; end end

4 years ago | 0

| accepted

Answered
Question regarding matrix with NaN.
s=sum(~isnan(X),2); a=X'; newX=[repelem(s',s');a(~isnan(a))'];

4 years ago | 0

| accepted

Answered
How can I input this data into a table without overwriting it?
You need to index. time=0;theta=pi/6;omega=pi/8;dt=.1;g=9.81;L=1; steps=30; for i = 2:steps time(i) = time(i-1) + dt; ...

4 years ago | 0

| accepted

Answered
find value and print
a =[30 36 4 16 5 22 17 23 66 26 15 27 7 8 8 4 10 2 3 1 7 ...

4 years ago | 0

Answered
I want to convert a single cell to a float number
Should already be a float double. If not then, double(celltest{1})

4 years ago | 0

Answered
How do I check for already used elements?
D = {a,b,c}; v=d(:,1); n=zeros(length(v),length(D)); for k=1:length(D) [~,m]=min(abs(v-(D{k}(:,2))'),[],2); n(:,k)=...

4 years ago | 0

Answered
determine how many terms in the series 3k2 where k = 0,1,2,3, .... are required for the sum of the terms, not to exceed 2000. What is the sum for this number of terms?
k=0:20; y=3*k.^2;%not sure what 3k2 means c=find(cumsum(y)<2000,1,'last');%number of terms

4 years ago | 0

Answered
Create vector with unique values
v=1+rand(1,5000);

4 years ago | 0

| accepted

Answered
Assigning the Values to 2-D Matrix which has 2 Elements in Each Point
Sounds like you need two matrices. A x matrix and a y matrix. [x,y]=meshgrid(0:100:200,0:250:500);

4 years ago | 1

Solved


Pythagorean's Triangle
Define a function called obama that takes two inputs as the two short edges of a right triangle and gives the length of hypotenu...

4 years ago

Answered
How to read a set of numerical characters for time and date
t=reshape(cell2mat(timechar)-'0',14,[]); HH=sum(a(1:2,:).*[10;1]); mm=sum(a(3:4).*[10;1]); mm=sum(a(3:4,:).*[10;1]); ss=sum(...

4 years ago | 0

Answered
How to synthesise discrete signal?
n=0:.01:819;%not sure what interval or frequency x=1.23.^(-n);

4 years ago | 0

Answered
How to implement MCTS using MATLAB?
https://stackoverflow.com/questions/33696091/efficient-tree-implementation-in-matlab

4 years ago | 2

Answered
How to multiply some columns in matrix by scalar
railwayarcsBIG=railwayarcs; railwayarcsBIG(:,3:12)=railwayarcsBIG(:,3:12)*100;

4 years ago | 0

Answered
Error : Constant Operands
Does changing to double work? I don't have the toolbox v = [1 1 2 : double(m)]

4 years ago | 0

| accepted

Load more